init: fix a case where execv's 1st arg was wrong

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-03-21 05:07:43 +01:00
parent e2e55b0eb5
commit 32176ccec4

View File

@ -414,6 +414,7 @@ static void init_exec(const char *command)
char *word, *next; char *word, *next;
int i = 0; int i = 0;
next = strcpy(buf, command - dash); /* command including "-" */ next = strcpy(buf, command - dash); /* command including "-" */
command = next + dash;
while ((word = strsep(&next, " \t")) != NULL) { while ((word = strsep(&next, " \t")) != NULL) {
if (*word != '\0') { /* not two spaces/tabs together? */ if (*word != '\0') { /* not two spaces/tabs together? */
cmd[i] = word; cmd[i] = word;