Skip to content

Commit

Permalink
lguest: Do not append space to guests kernel command line
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Bolle authored and Rusty Russell committed Mar 10, 2008
1 parent 4357bd9 commit 1ef36fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 1ef36fa

Please sign in to comment.