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,11 +81,11 @@ static struct uri * parse_next_server_and_filename ( struct in_addr next_server,
81 81
 	 * filenames with and without initial slashes, which is
82 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 85
 		uri_put ( uri );
86 86
 		snprintf ( buf, sizeof ( buf ), "tftp://%s/%s",
87 87
 			   inet_ntoa ( next_server ), filename );
88
-		uri = parse_uri ( filename );
88
+		uri = parse_uri ( buf );
89 89
 		if ( ! uri )
90 90
 			return NULL;
91 91
 	}
@@ -130,7 +130,7 @@ int uriboot ( struct uri *filename, struct uri *root_path ) {
130 130
 	}
131 131
 
132 132
 	/* Treat empty URIs as absent */
133
-	if ( filename && ( ! filename->path ) )
133
+	if ( filename && ( ! uri_has_path ( filename ) ) )
134 134
 		filename = NULL;
135 135
 	if ( root_path && ( ! uri_is_absolute ( root_path ) ) )
136 136
 		root_path = NULL;

Loading…
Cancel
Save