]> git.ozlabs.org Git - petitboot/commitdiff
discover/boot: Allow null boot command
authorJeremy Kerr <jk@ozlabs.org>
Tue, 21 May 2013 05:32:11 +0000 (13:32 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 24 Jun 2013 04:52:49 +0000 (12:52 +0800)
If we're booting from a default option, we don't have a boot command.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/boot.c

index 29aefa916a8e149b973c69baccbb52b6a6bef799..5ca69b9f135f3cdbc032ccd7168311685e3adf5a 100644 (file)
@@ -140,7 +140,7 @@ int boot(void *ctx, struct discover_boot_option *opt, struct boot_command *cmd,
        initrd = NULL;
        args = NULL;
 
        initrd = NULL;
        args = NULL;
 
-       if (cmd->boot_image_file) {
+       if (cmd && cmd->boot_image_file) {
                image = pb_url_parse(opt, cmd->boot_image_file);
        } else if (opt && opt->boot_image) {
                image = opt->boot_image->url;
                image = pb_url_parse(opt, cmd->boot_image_file);
        } else if (opt && opt->boot_image) {
                image = opt->boot_image->url;
@@ -149,13 +149,13 @@ int boot(void *ctx, struct discover_boot_option *opt, struct boot_command *cmd,
                return -1;
        }
 
                return -1;
        }
 
-       if (cmd->initrd_file) {
+       if (cmd && cmd->initrd_file) {
                initrd = pb_url_parse(opt, cmd->initrd_file);
        } else if (opt && opt->initrd) {
                initrd = opt->initrd->url;
        }
 
                initrd = pb_url_parse(opt, cmd->initrd_file);
        } else if (opt && opt->initrd) {
                initrd = opt->initrd->url;
        }
 
-       if (cmd->boot_args) {
+       if (cmd && cmd->boot_args) {
                args = talloc_strdup(ctx, cmd->boot_args);
        } else if (opt && opt->option->boot_args) {
                args = talloc_strdup(ctx, opt->option->boot_args);
                args = talloc_strdup(ctx, cmd->boot_args);
        } else if (opt && opt->option->boot_args) {
                args = talloc_strdup(ctx, opt->option->boot_args);