Package: etherboot
Version: 5.4.2-1.1
Severity: important
Tags: patch

The tftp_get_file command returns always zero and do not
propagate an error code like "file not found", received
from a tftp-server, to the caller. The attached patch
fix this.


    Bernhard Kauer
--- etherboot-5.4.2.orig/src/core/nic.c
+++ etherboot-5.4.2/src/core/nic.c
@@ -720,7 +720,7 @@
        struct tftpblk_info_t block;
        int rc;
 
-       while ( tftp_block ( request, &block ) ) {
+       while ( 0 < ((rc = tftp_block ( request, &block ) ) ) ) {
                request = NULL; /* Send request only once */
                rc = fnc ( block.data, block.block, block.len, block.eof );
                if ( rc <= 0 ) return (rc);
@@ -730,7 +730,7 @@
                        return (0);
                }
        }
-       return (0);
+       return (rc);
 }
 
 int tftp_block ( struct tftpreq_info_t *request, struct tftpblk_info_t *block )
@@ -792,7 +792,7 @@
                        printf ( "TFTP error %d (%s)\n",
                                 ntohs(rcvd->u.err.errcode),
                                 rcvd->u.err.errmsg );
-                       return (0); /* abort */
+                       return (-ntohs(rcvd->u.err.errcode)); /* abort */
                }
                case TFTP_OACK : {
                        const char *p = rcvd->u.oack.data;

Reply via email to