]> git.ozlabs.org Git - petitboot/blobdiff - discover/device-handler.c
discover: Allow device_handler_boot with no option
[petitboot] / discover / device-handler.c
index 04a44848d4c452db00e7c9e80cda0b5c6274ac9e..142f6a490028508056415ab99e78f020f035b309 100644 (file)
@@ -650,9 +650,10 @@ static struct discover_boot_option *find_boot_option_by_id(
 void device_handler_boot(struct device_handler *handler,
                struct boot_command *cmd)
 {
-       struct discover_boot_option *opt;
+       struct discover_boot_option *opt = NULL;
 
-       opt = find_boot_option_by_id(handler, cmd->option_id);
+       if (cmd->option_id && strlen(cmd->option_id))
+               opt = find_boot_option_by_id(handler, cmd->option_id);
 
        boot(handler, opt, cmd, handler->dry_run, boot_status, handler);
 }
@@ -803,11 +804,12 @@ static int umount_device(struct discover_device *dev)
                return -1;
 
        dev->mounted = false;
-       talloc_free(dev->mount_path);
-       dev->mount_path = NULL;
 
        pb_rmdir_recursive(mount_base(), dev->mount_path);
 
+       talloc_free(dev->mount_path);
+       dev->mount_path = NULL;
+
        return 0;
 }