summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Bolle2008-03-10 16:39:03 +0100
committerRusty Russell2008-03-10 23:35:58 +0100
commit1ef36fa64e65079de18ff5179a51af58e44d49a6 (patch)
tree3c59c9e4ed6327327191e916051c5f088e7478bf
parentlguest: Revert 1ce70c4fac3c3954bd48c035f448793867592bc0, fix real problem. (diff)
downloadkernel-qcow2-linux-1ef36fa64e65079de18ff5179a51af58e44d49a6.tar.gz
kernel-qcow2-linux-1ef36fa64e65079de18ff5179a51af58e44d49a6.tar.xz
kernel-qcow2-linux-1ef36fa64e65079de18ff5179a51af58e44d49a6.zip
lguest: Do not append space to guests kernel command line
The lguest launcher appends a space to the kernel command line (if kernel arguments are specified on its command line). This space is unneeded. More importantly, this appended space will make Red Hat's nash script interpreter (used in a Fedora style initramfs) add an empty argument to init's command line. This empty argument will make kernel arguments like "init=/bin/bash" fail (because the shell will try to execute a script with an empty name). This could be considered a bug in nash, but is easily fixed in the lguest launcher too. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--Documentation/lguest/lguest.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 0f23d67f958f..bec5a32e4095 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -486,9 +486,12 @@ static void concat(char *dst, char *args[])
unsigned int i, len = 0;
for (i = 0; args[i]; i++) {
+ if (i) {
+ strcat(dst+len, " ");
+ len++;
+ }
strcpy(dst+len, args[i]);
- strcat(dst+len, " ");
- len += strlen(args[i]) + 1;
+ len += strlen(args[i]);
}
/* In case it's empty. */
dst[len] = '\0';