Odd. I never brought this forward from bb.stable. Should handle
authorEric Andersen <andersen@codepoet.org>
Tue, 17 Dec 2002 09:48:16 +0000 (09:48 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 17 Dec 2002 09:48:16 +0000 (09:48 -0000)
reaping child processes better.
 -Erik

init/init.c

index bb1f383b3113173bab56bd3d443b9eaeb36a6811..91a19c5d16a39e01de8087a4c3f9d8fb3b414bbd 100644 (file)
@@ -1141,7 +1141,7 @@ extern int init_main(int argc, char **argv)
 
                /* Wait for a child process to exit */
                wpid = wait(&status);
-               if (wpid > 0) {
+               while (wpid > 0) {
                        /* Find out who died and clean up their corpse */
                        for (a = init_action_list; a; a = a->next) {
                                if (a->pid == wpid) {
@@ -1152,6 +1152,8 @@ extern int init_main(int argc, char **argv)
                                                        "Scheduling it for restart.\n", a->command, wpid);
                                }
                        }
+                       /* see if anyone else is waiting to be reaped */
+                       wpid = waitpid (-1, &status, WNOHANG);
                }
        }
 }