Browse Source

[autoboot] Cope properly with empty DHCP filenames

This (hopefully) fixes a regression introduced in commit e088892
("[autoboot] Connect SAN disk during a filename boot, if applicable").

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
88b8aa0f65
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      src/usr/autoboot.c

+ 3
- 3
src/usr/autoboot.c View File

81
 	 * filenames with and without initial slashes, which is
81
 	 * filenames with and without initial slashes, which is
82
 	 * significant for TFTP.
82
 	 * significant for TFTP.
83
 	 */
83
 	 */
84
-	if ( ! uri_is_absolute ( uri ) ) {
84
+	if ( next_server.s_addr && filename[0] && ! uri_is_absolute ( uri ) ) {
85
 		uri_put ( uri );
85
 		uri_put ( uri );
86
 		snprintf ( buf, sizeof ( buf ), "tftp://%s/%s",
86
 		snprintf ( buf, sizeof ( buf ), "tftp://%s/%s",
87
 			   inet_ntoa ( next_server ), filename );
87
 			   inet_ntoa ( next_server ), filename );
88
-		uri = parse_uri ( filename );
88
+		uri = parse_uri ( buf );
89
 		if ( ! uri )
89
 		if ( ! uri )
90
 			return NULL;
90
 			return NULL;
91
 	}
91
 	}
130
 	}
130
 	}
131
 
131
 
132
 	/* Treat empty URIs as absent */
132
 	/* Treat empty URIs as absent */
133
-	if ( filename && ( ! filename->path ) )
133
+	if ( filename && ( ! uri_has_path ( filename ) ) )
134
 		filename = NULL;
134
 		filename = NULL;
135
 	if ( root_path && ( ! uri_is_absolute ( root_path ) ) )
135
 	if ( root_path && ( ! uri_is_absolute ( root_path ) ) )
136
 		root_path = NULL;
136
 		root_path = NULL;

Loading…
Cancel
Save