svn commit: trunk/busybox/init
vda at busybox.net
vda at busybox.net
Fri Jan 4 15:10:48 UTC 2008
Author: vda
Date: 2008-01-04 07:10:47 -0800 (Fri, 04 Jan 2008)
New Revision: 20706
Log:
init: wait for orphaned children too while waiting
for sysinit-like processes (Harald K?\195?\188the <harald-tuxbox at arcor.de>)
Modified:
trunk/busybox/init/init.c
Changeset:
Modified: trunk/busybox/init/init.c
===================================================================
--- trunk/busybox/init/init.c 2008-01-03 13:33:30 UTC (rev 20705)
+++ trunk/busybox/init/init.c 2008-01-04 15:10:47 UTC (rev 20706)
@@ -97,10 +97,16 @@
static void delete_init_action(struct init_action *a);
static void halt_reboot_pwoff(int sig) ATTRIBUTE_NORETURN;
-/* TODO: move to libbb? */
-static int waitfor(pid_t runpid)
+static void waitfor(pid_t pid)
{
- return safe_waitpid(runpid, NULL, 0);
+ /* waitfor(run(x)): protect against failed fork inside run() */
+ if (pid <= 0)
+ return;
+
+ /* Wait for any child (prevent zombies from exiting orphaned processes)
+ * but exit the loop only when specified one has exited. */
+ while (wait(NULL) != pid)
+ continue;
}
static void loop_forever(void) ATTRIBUTE_NORETURN;
More information about the busybox-cvs
mailing list