summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-05 13:56:49 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-05 13:58:26 -0700
commit401edbe977d7993e69f683529b480a73ec8e3e56 (patch)
tree53cc058d95dd224ab6b1df4475fe57ee0f6680e6
parent1b3adda8be6bb9dc04108880d84bba12e68fd9c9 (diff)
downloadsyslinux-401edbe977d7993e69f683529b480a73ec8e3e56.tar.gz
linux.c32: replace the kernel name with BOOT_IMAGE=syslinux-3.81-pre2
The BOOT_IMAGE= argument is generated by replacing the kernel name in the argument array. As a result, we shouldn't advance argp. Move the code around slightly, to make it more obvious that that is what is happening. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/modules/linux.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/com32/modules/linux.c b/com32/modules/linux.c
index 70afdcb6..0c40df2d 100644
--- a/com32/modules/linux.c
+++ b/com32/modules/linux.c
@@ -143,7 +143,16 @@ int main(int argc, char *argv[])
}
kernel_name = arg;
- argp++;
+
+ boot_image = malloc(strlen(kernel_name)+12);
+ if (!boot_image)
+ goto bail;
+ strcpy(boot_image, "BOOT_IMAGE=");
+ strcpy(boot_image+11, kernel_name);
+ /* argp now points to the kernel name, and the command line follows.
+ Overwrite the kernel name with the BOOT_IMAGE= argument, and thus
+ we have the final argument. */
+ *argp = boot_image;
if (find_boolean(argp,"quiet"))
opt_quiet = true;
@@ -159,18 +168,6 @@ int main(int argc, char *argv[])
if (!opt_quiet)
printf("ok\n");
- boot_image = malloc(strlen(kernel_name)+12);
- if (!boot_image)
- goto bail;
-
- strcpy(boot_image, "BOOT_IMAGE=");
- strcpy(boot_image+11, kernel_name);
-
- /* argp now points to the kernel name, and the command line follows.
- Overwrite the kernel name with the BOOT_IMAGE= argument, and thus
- we have the final argument. */
- *argp = boot_image;
-
cmdline = make_cmdline(argp);
if (!cmdline)
goto bail;