summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/boot/lib/libstand/tftp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr/src/boot/lib/libstand/tftp.c b/usr/src/boot/lib/libstand/tftp.c
index e235f8a537..ad3e89d448 100644
--- a/usr/src/boot/lib/libstand/tftp.c
+++ b/usr/src/boot/lib/libstand/tftp.c
@@ -487,6 +487,9 @@ tftp_read(struct open_file *f, void *addr, size_t size,
size_t *resid /* out */)
{
struct tftp_handle *tftpfile;
+ int rc;
+
+ rc = 0;
tftpfile = (struct tftp_handle *) f->f_fsdata;
while (size > 0) {
@@ -498,19 +501,19 @@ tftp_read(struct open_file *f, void *addr, size_t size,
if (tftpfile->currblock > needblock) { /* seek backwards */
tftp_senderr(tftpfile, 0, "No error: read aborted");
- tftp_makereq(tftpfile); /* no error check, it worked
- * for open */
+ rc = tftp_makereq(tftpfile);
+ if (rc != 0)
+ break;
}
while (tftpfile->currblock < needblock) {
- int res;
- res = tftp_getnextblock(tftpfile);
- if (res) { /* no answer */
+ rc = tftp_getnextblock(tftpfile);
+ if (rc) { /* no answer */
#ifdef TFTP_DEBUG
printf("tftp: read error\n");
#endif
- return (res);
+ return (rc);
}
if (tftpfile->islastblock)
break;
@@ -550,7 +553,7 @@ tftp_read(struct open_file *f, void *addr, size_t size,
if (resid)
*resid = size;
- return (0);
+ return (rc);
}
static int