]> git.ozlabs.org Git - petitboot/blobdiff - discover/user-event.c
discover/pxe: Fix prefix autodetection when bootfile is in the root dir
[petitboot] / discover / user-event.c
index dc671d948fb04aa28c80c56caabebda01da3d0f4..cf7f20c599bbefdac3c004834dc75966500a7a4b 100644 (file)
@@ -208,7 +208,7 @@ static char *parse_mac_addr(struct discover_context *ctx, const char *mac)
                        mac_addr_arr + 2, mac_addr_arr + 3, mac_addr_arr + 4,
                        mac_addr_arr + 5);
 
-       mac_addr = talloc_asprintf(ctx, "01-%02X-%02X-%02X-%02X-%02X-%02X",
+       mac_addr = talloc_asprintf(ctx, "01-%02x-%02x-%02x-%02x-%02x-%02x",
                        mac_addr_arr[0], mac_addr_arr[1], mac_addr_arr[2],
                        mac_addr_arr[3], mac_addr_arr[4], mac_addr_arr[5]);
 
@@ -290,8 +290,9 @@ struct pb_url *user_event_parse_conf_url(struct discover_context *ctx,
                /* strip filename from the bootfile path, leaving only a
                 * directory */
                p = strrchr(basedir, '/');
-               if (p)
-                       *p = '\0';
+               if (!p)
+                       p = basedir;
+               *p = '\0';
 
                if (strlen(basedir))
                        url_str = talloc_asprintf_append(url_str, "%s/",