summaryrefslogtreecommitdiff
path: root/kexec/kexec.c
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/kexec.c
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/kexec.c')
-rw-r--r--kexec/kexec.c16
1 files changed, 16 insertions, 0 deletions
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[])
{