Skip to content

Commit

Permalink
[autoboot] Cope properly with empty DHCP filenames
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Feb 1, 2011
1 parent d77b183 commit 88b8aa0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/usr/autoboot.c
Expand Up @@ -81,11 +81,11 @@ static struct uri * parse_next_server_and_filename ( struct in_addr next_server,
* filenames with and without initial slashes, which is
* significant for TFTP.
*/
if ( ! uri_is_absolute ( uri ) ) {
if ( next_server.s_addr && filename[0] && ! uri_is_absolute ( uri ) ) {
uri_put ( uri );
snprintf ( buf, sizeof ( buf ), "tftp://%s/%s",
inet_ntoa ( next_server ), filename );
uri = parse_uri ( filename );
uri = parse_uri ( buf );
if ( ! uri )
return NULL;
}
Expand Down Expand Up @@ -130,7 +130,7 @@ int uriboot ( struct uri *filename, struct uri *root_path ) {
}

/* Treat empty URIs as absent */
if ( filename && ( ! filename->path ) )
if ( filename && ( ! uri_has_path ( filename ) ) )
filename = NULL;
if ( root_path && ( ! uri_is_absolute ( root_path ) ) )
root_path = NULL;
Expand Down

0 comments on commit 88b8aa0

Please sign in to comment.