If we're running as init, install a signal handler for SIGCHLD.
PR: bin/14729 Submitted by: jhb
This commit is contained in:
parent
3da21d9f07
commit
810fd59fbb
@ -85,6 +85,18 @@ handle_intr(int sig)
|
||||
restorescr(save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Harvest children if we are init.
|
||||
*/
|
||||
static void
|
||||
reap_children(int sig)
|
||||
{
|
||||
int errbak = errno;
|
||||
while ( waitpid(-1, NULL, WNOHANG) > 0 )
|
||||
;
|
||||
errno = errbak;
|
||||
}
|
||||
|
||||
/* Expand a file into a convenient location, nuking it each time */
|
||||
static char *
|
||||
expand(char *fname)
|
||||
@ -166,6 +178,7 @@ systemInitialize(int argc, char **argv)
|
||||
i = 0;
|
||||
sysctlbyname("machdep.unaligned_print", NULL, 0, &i, sizeof(i));
|
||||
#endif
|
||||
signal(SIGCHLD, reap_children);
|
||||
}
|
||||
else {
|
||||
char hname[256];
|
||||
|
@ -85,6 +85,18 @@ handle_intr(int sig)
|
||||
restorescr(save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Harvest children if we are init.
|
||||
*/
|
||||
static void
|
||||
reap_children(int sig)
|
||||
{
|
||||
int errbak = errno;
|
||||
while ( waitpid(-1, NULL, WNOHANG) > 0 )
|
||||
;
|
||||
errno = errbak;
|
||||
}
|
||||
|
||||
/* Expand a file into a convenient location, nuking it each time */
|
||||
static char *
|
||||
expand(char *fname)
|
||||
@ -166,6 +178,7 @@ systemInitialize(int argc, char **argv)
|
||||
i = 0;
|
||||
sysctlbyname("machdep.unaligned_print", NULL, 0, &i, sizeof(i));
|
||||
#endif
|
||||
signal(SIGCHLD, reap_children);
|
||||
}
|
||||
else {
|
||||
char hname[256];
|
||||
|
Loading…
Reference in New Issue
Block a user