]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[tftp] Avoid setting current working URI to "tftp://0.0.0.0/"
authorMichael Brown <mcb30@ipxe.org>
Thu, 31 Mar 2011 03:52:47 +0000 (04:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 31 Mar 2011 03:54:27 +0000 (04:54 +0100)
Set the current working URI to NULL rather than to "tftp://0.0.0.0/".

Reported-by: Piotr JaroszyƄski <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/udp/tftp.c

index f4e9f4c616ca3c51a6363075b0131fb6b4002922..7cd211e41ab8de61df667450078fff9670848e41 100644 (file)
@@ -1245,11 +1245,15 @@ static int tftp_apply_settings ( void ) {
         * applicators.
         */
        if ( tftp_server.s_addr != last_tftp_server.s_addr ) {
-               snprintf ( uri_string, sizeof ( uri_string ),
-                          "tftp://%s/", inet_ntoa ( tftp_server ) );
-               uri = parse_uri ( uri_string );
-               if ( ! uri )
-                       return -ENOMEM;
+               if ( tftp_server.s_addr ) {
+                       snprintf ( uri_string, sizeof ( uri_string ),
+                                  "tftp://%s/", inet_ntoa ( tftp_server ) );
+                       uri = parse_uri ( uri_string );
+                       if ( ! uri )
+                               return -ENOMEM;
+               } else {
+                       uri = NULL;
+               }
                churi ( uri );
                uri_put ( uri );
        }