From: Eric Andersen Date: Thu, 23 Aug 2001 19:18:06 +0000 (-0000) Subject: Part of a patch from Magick tha fixes a bug X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=43a6ed1171414eb84e624f4976a8a8b67cd4ba84;p=oweals%2Fbusybox.git Part of a patch from Magick tha fixes a bug AskFirst where reading from /dev/null gives EOF. --- diff --git a/busybox/init.c b/busybox/init.c index f397b7e0a..45b510fa1 100644 --- a/busybox/init.c +++ b/busybox/init.c @@ -714,6 +714,9 @@ static void new_initAction(initActionEnum action, char *process, char *cons) if (secondConsole == NULL && strcmp(cons, console) && strcmp(cons, "/dev/null")) return; + if (strcmp(cons, "/dev/null") == 0 && action == ASKFIRST) + return; + newAction = calloc((size_t) (1), sizeof(initAction)); if (!newAction) { @@ -960,23 +963,11 @@ extern int init_main(int argc, char **argv) /* Now run everything that needs to be run */ /* First run the sysinit command */ - for (a = initActionList; a; a = tmp) { - tmp = a->nextPtr; - if (a->action == SYSINIT) { - waitfor(a->process, a->console, FALSE); - /* Now remove the "sysinit" entry from the list */ - delete_initAction(a); - } - } + run_actions(SYSINIT); + /* Next run anything that wants to block */ - for (a = initActionList; a; a = tmp) { - tmp = a->nextPtr; - if (a->action == WAIT) { - waitfor(a->process, a->console, FALSE); - /* Now remove the "wait" entry from the list */ - delete_initAction(a); - } - } + run_actions(WAIT); + /* Next run anything to be run only once */ for (a = initActionList; a; a = tmp) { tmp = a->nextPtr; diff --git a/busybox/init/init.c b/busybox/init/init.c index f397b7e0a..45b510fa1 100644 --- a/busybox/init/init.c +++ b/busybox/init/init.c @@ -714,6 +714,9 @@ static void new_initAction(initActionEnum action, char *process, char *cons) if (secondConsole == NULL && strcmp(cons, console) && strcmp(cons, "/dev/null")) return; + if (strcmp(cons, "/dev/null") == 0 && action == ASKFIRST) + return; + newAction = calloc((size_t) (1), sizeof(initAction)); if (!newAction) { @@ -960,23 +963,11 @@ extern int init_main(int argc, char **argv) /* Now run everything that needs to be run */ /* First run the sysinit command */ - for (a = initActionList; a; a = tmp) { - tmp = a->nextPtr; - if (a->action == SYSINIT) { - waitfor(a->process, a->console, FALSE); - /* Now remove the "sysinit" entry from the list */ - delete_initAction(a); - } - } + run_actions(SYSINIT); + /* Next run anything that wants to block */ - for (a = initActionList; a; a = tmp) { - tmp = a->nextPtr; - if (a->action == WAIT) { - waitfor(a->process, a->console, FALSE); - /* Now remove the "wait" entry from the list */ - delete_initAction(a); - } - } + run_actions(WAIT); + /* Next run anything to be run only once */ for (a = initActionList; a; a = tmp) { tmp = a->nextPtr;