diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-21 22:34:19 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-26 12:34:13 +0000 |
commit | 71e195441ea968c0fd9af48c1d2e5823b7a0db41 (patch) | |
tree | eed87944f72bec90be45896d7951fefee7bab21e | |
parent | b8dfe78a33e70f657f8aadb48de644a92bf82850 (diff) | |
download | syslinux-71e195441ea968c0fd9af48c1d2e5823b7a0db41.tar.gz |
runimage.c: Actually pass arguments to execute()
Fix the breakage from commit 8486142cf304 ("elflink: Replace
__intcall() with direct function calls"), where we stopped passing
'cmdline' to execute().
This bug resulted in things like config.c32 not respecting the
<directory> argument.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | com32/lib/syslinux/runimage.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/com32/lib/syslinux/runimage.c b/com32/lib/syslinux/runimage.c index 4391114c..d3db75f3 100644 --- a/com32/lib/syslinux/runimage.c +++ b/com32/lib/syslinux/runimage.c @@ -42,26 +42,22 @@ extern unsigned int ipappend; void syslinux_run_kernel_image(const char *filename, const char *cmdline, uint32_t ipappend_flags, uint32_t type) { - char *bbfilename = NULL; char *bbcmdline = NULL; + size_t len; + int rv; - - bbfilename = lstrdup(filename); - if (!bbfilename) - goto fail; - - bbcmdline = lstrdup(cmdline); + /* +2 for NULL and space */ + len = strlen(filename) + strlen(cmdline) + 2; + bbcmdline = malloc(len); if (!bbcmdline) - goto fail; + return; + + rv = snprintf(bbcmdline, len, "%s %s", filename, cmdline); + if (rv == -1 || (size_t)rv >= len) + return; if (syslinux_filesystem() == SYSLINUX_FS_PXELINUX) ipappend = ipappend_flags; - execute(bbfilename, type); - -fail: - if (bbcmdline) - lfree(bbcmdline); - if (bbfilename) - lfree(bbfilename); + execute(bbcmdline, type); } |