summaryrefslogtreecommitdiffstats
path: root/src/net/udp/tftp.c
diff options
context:
space:
mode:
authorMichael Brown2011-03-31 05:52:47 +0200
committerMichael Brown2011-03-31 05:54:27 +0200
commit58dcb2e15e2da84c6bdd7313ac6b090748474cce (patch)
tree1427ba167a50635755c0c0cdfb3edbf91fe60f70 /src/net/udp/tftp.c
parent[efi] Synchronise EFI header files (diff)
downloadipxe-58dcb2e15e2da84c6bdd7313ac6b090748474cce.tar.gz
ipxe-58dcb2e15e2da84c6bdd7313ac6b090748474cce.tar.xz
ipxe-58dcb2e15e2da84c6bdd7313ac6b090748474cce.zip
[tftp] Avoid setting current working URI to "tftp://0.0.0.0/"
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>
Diffstat (limited to 'src/net/udp/tftp.c')
-rw-r--r--src/net/udp/tftp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c
index f4e9f4c6..7cd211e4 100644
--- a/src/net/udp/tftp.c
+++ b/src/net/udp/tftp.c
@@ -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 );
}