34 lines
942 B
Diff
34 lines
942 B
Diff
--- src/init.c
|
|
+++ src/init.c 2005-10-19 12:01:15.000000000 +0200
|
|
@@ -20,6 +20,14 @@
|
|
*
|
|
*/
|
|
|
|
+/*
|
|
+ * 4 Sep 2001, Andrea Arcangeli:
|
|
+ * Fix a race in spawn() that is used to deadlock init in a
|
|
+ * waitpid() loop: must set the childhandler as default before forking
|
|
+ * off the child or the chld_handler could run before the waitpid loop
|
|
+ * has a chance to find its zombie-child.
|
|
+ */
|
|
+
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/ioctl.h>
|
|
@@ -966,6 +974,7 @@
|
|
dup(f);
|
|
dup(f);
|
|
}
|
|
+ SETSIG(sa, SIGCHLD, SIG_DFL, SA_RESTART);
|
|
if ((pid = fork()) < 0) {
|
|
initlog(L_VB, "cannot fork");
|
|
exit(1);
|
|
@@ -978,7 +987,6 @@
|
|
SETSIG(sa, SIGINT, SIG_IGN, SA_RESTART);
|
|
SETSIG(sa, SIGTSTP, SIG_IGN, SA_RESTART);
|
|
SETSIG(sa, SIGQUIT, SIG_IGN, SA_RESTART);
|
|
- SETSIG(sa, SIGCHLD, SIG_DFL, SA_RESTART);
|
|
|
|
while ((rc = waitpid(pid, &st, 0)) != pid)
|
|
if (rc < 0 && errno == ECHILD)
|