]> git.ozlabs.org Git - petitboot/commitdiff
Fix check for null initrd and boot args
authorJeremy Kerr <jk@ozlabs.org>
Mon, 7 Jan 2008 10:50:33 +0000 (21:50 +1100)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 7 Jan 2008 10:50:33 +0000 (21:50 +1100)
Because the strings are read from the pb socket, we need to check
for an empty string, not a NULL string.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
devices.c

index 37798105d58d87528b252833955df332324de04c..57c037e23c98121684cb76587f878bca009e6ecf 100644 (file)
--- a/devices.c
+++ b/devices.c
@@ -286,12 +286,12 @@ void pboot_exec_option(void *data)
 
        kexec_opts[0] = "/usr/sbin/kexec";
        kexec_opts[1] = "-f";
-       if (opt->initrd_file) {
+       if (opt->initrd_file && *opt->initrd_file) {
                kexec_opts[nr_opts] = malloc(10 + strlen(opt->initrd_file));
                sprintf(kexec_opts[nr_opts], "--initrd=%s", opt->initrd_file);
                nr_opts++;
        }
-       if (opt->boot_args)  {
+       if (opt->boot_args && *opt->boot_args)  {
                kexec_opts[nr_opts] = malloc(10 + strlen(opt->boot_args));
                sprintf(kexec_opts[nr_opts], "--command-line=%s",
                        opt->boot_args);