From 8b42c99aa3bc59b877732a82e6db6380e4958b54 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 19 Jan 2010 00:05:03 -0800 Subject: 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 --- kexec/kexec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'kexec/kexec.c') diff --git a/kexec/kexec.c b/kexec/kexec.c index a1cec86..f4c22a6 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -994,6 +994,22 @@ void check_reuse_initrd(void) free(line); } +const char *concat_cmdline(const char *base, const char *append) +{ + const char *cmdline; + if (!base && !append) + return NULL; + if (!base) + return append; + if (!append) + return base; + cmdline = xmalloc(strlen(base) + 1 + strlen(append) + 1); + strcpy(cmdline, base); + strcat(cmdline, " "); + strcat(cmdline, append); + return cmdline; +} + int main(int argc, char *argv[]) { -- cgit