aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-02-21 14:24:57 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-02-21 14:31:21 +0000
commitab018ba3ce947f206bda2fc3c367a7eb4504b553 (patch)
tree693fc004d2cb13911ce46cec1fa64e3fc6520044
parent07395d946e566263525f08f31692678422976a21 (diff)
downloadsyslinux-ab018ba3ce947f206bda2fc3c367a7eb4504b553.tar.gz
syslinux-ab018ba3ce947f206bda2fc3c367a7eb4504b553.tar.xz
syslinux-ab018ba3ce947f206bda2fc3c367a7eb4504b553.zip
ldlinux: Don't discard cmdline arguments when executing labels
Don't throw away additional cmdline arguments when executing a label. Append them instead. Gene Cumm reports, When using the CLI and calling a LABEL "mylabel", specifying "mylabel options" does not pass "options" through to the kernel's command line. Reported-by: Gene Cumm <gene.cumm@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/elflink/ldlinux/ldlinux.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 92346ee5..c692d75a 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -154,9 +154,29 @@ __export void load_kernel(const char *command_line)
/* Virtual kernel? */
me = find_label(kernel);
if (me) {
- type = parse_image_type(me->cmdline);
+ const char *args;
+ char *cmd;
+ size_t len = strlen(me->cmdline) + 1;
- execute(me->cmdline, type);
+ /* Find the end of the command */
+ args = find_command(kernel);
+ while(*args && my_isspace(*args))
+ args++;
+
+ if (strlen(args))
+ len += strlen(args) + 1; /* +1 for space (' ') */
+
+ cmd = malloc(len);
+ if (!cmd)
+ goto bad_kernel;
+
+ if (strlen(args))
+ snprintf(cmd, len, "%s %s", me->cmdline, args);
+ else
+ strncpy(cmd, me->cmdline, len);
+
+ type = parse_image_type(cmd);
+ execute(cmd, type);
/* We shouldn't return */
goto bad_kernel;
}