summaryrefslogtreecommitdiff
path: root/kexec/arch/x86_64
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-01-19 00:05:03 -0800
committerSimon Horman <horms@verge.net.au>2010-02-02 14:42:02 +1100
commit8b42c99aa3bc59b877732a82e6db6380e4958b54 (patch)
tree7ce24a95b77bd5802bd877be772fb99d9198c352 /kexec/arch/x86_64
parent1875419755e36ac49c53c166c033ed5c181287b6 (diff)
Fix --reuse-cmdline so it is usable.
A colleague of mine implemented kdump and it used --reuse-cmdline with some rather interesting and unexpected results. Update the getopt specification so that --reuse-cmdline does not attempt to take an argument that it will not use. Update the processing of --append so that --reuse-cmdline followed by --append actually appends the parameters specified by --reuse-cmdline. Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Diffstat (limited to 'kexec/arch/x86_64')
-rw-r--r--kexec/arch/x86_64/kexec-elf-x86_64.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c
index 95ebef6..901262f 100644
--- a/kexec/arch/x86_64/kexec-elf-x86_64.c
+++ b/kexec/arch/x86_64/kexec-elf-x86_64.c
@@ -87,7 +87,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
struct kexec_info *info)
{
struct mem_ehdr ehdr;
- const char *command_line;
+ const char *command_line = NULL, *append = NULL;
char *modified_cmdline;
int command_line_len;
int modified_cmdline_len;
@@ -109,7 +109,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
KEXEC_ARCH_OPTIONS
{ "command-line", 1, NULL, OPT_APPEND },
{ "append", 1, NULL, OPT_APPEND },
- { "reuse-cmdline", 1, NULL, OPT_REUSE_CMDLINE },
+ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE },
{ "initrd", 1, NULL, OPT_RAMDISK },
{ "ramdisk", 1, NULL, OPT_RAMDISK },
{ "args-elf", 0, NULL, OPT_ARGS_ELF },
@@ -124,7 +124,6 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
* Parse the command line arguments
*/
arg_style = ARG_STYLE_ELF;
- command_line = 0;
modified_cmdline = 0;
modified_cmdline_len = 0;
ramdisk = 0;
@@ -140,7 +139,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
usage();
return -1;
case OPT_APPEND:
- command_line = optarg;
+ append = optarg;
break;
case OPT_REUSE_CMDLINE:
command_line = get_command_line();
@@ -163,6 +162,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
break;
}
}
+ command_line = concat_cmdline(command_line, append);
command_line_len = 0;
if (command_line) {
command_line_len = strlen(command_line) +1;