aboutsummaryrefslogtreecommitdiff
path: root/init/init.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-01-04 15:10:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-01-04 15:10:47 +0000
commit21e20cb4ad106b9d49ff24652a5cd47380905d4d (patch)
treebf568707e67d1857dc844dbdddbd18e57fe06ad4 /init/init.c
parent4dada747e54b11f05db1beda3f4653ffe432255c (diff)
downloadbusybox-w32-21e20cb4ad106b9d49ff24652a5cd47380905d4d.tar.gz
busybox-w32-21e20cb4ad106b9d49ff24652a5cd47380905d4d.tar.bz2
busybox-w32-21e20cb4ad106b9d49ff24652a5cd47380905d4d.zip
init: wait for orphaned children too while waiting
for sysinit-like processes (Harald Küthe <harald-tuxbox@arcor.de>)
Diffstat (limited to 'init/init.c')
-rw-r--r--init/init.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/init/init.c b/init/init.c
index 68a59d88e..f7eb8f34b 100644
--- a/init/init.c
+++ b/init/init.c
@@ -97,10 +97,16 @@ static const char *const environment[] = {
97static void delete_init_action(struct init_action *a); 97static void delete_init_action(struct init_action *a);
98static void halt_reboot_pwoff(int sig) ATTRIBUTE_NORETURN; 98static void halt_reboot_pwoff(int sig) ATTRIBUTE_NORETURN;
99 99
100/* TODO: move to libbb? */ 100static void waitfor(pid_t pid)
101static int waitfor(pid_t runpid)
102{ 101{
103 return safe_waitpid(runpid, NULL, 0); 102 /* waitfor(run(x)): protect against failed fork inside run() */
103 if (pid <= 0)
104 return;
105
106 /* Wait for any child (prevent zombies from exiting orphaned processes)
107 * but exit the loop only when specified one has exited. */
108 while (wait(NULL) != pid)
109 continue;
104} 110}
105 111
106static void loop_forever(void) ATTRIBUTE_NORETURN; 112static void loop_forever(void) ATTRIBUTE_NORETURN;