supervise-daemon: reap zombies
We need to make sure to reap zombies so that we can shut down successfully. Fixes #252. Possibly related to #250.
This commit is contained in:
parent
025c9693cc
commit
008c9d0036
@ -197,6 +197,16 @@ static void healthcheck(int sig)
|
|||||||
do_healthcheck = 1;
|
do_healthcheck = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void reap_zombies(int sig)
|
||||||
|
{
|
||||||
|
int serrno;
|
||||||
|
(void) sig;
|
||||||
|
|
||||||
|
serrno = errno;
|
||||||
|
while (waitpid((pid_t)(-1), NULL, WNOHANG) > 0) {}
|
||||||
|
errno = serrno;
|
||||||
|
}
|
||||||
|
|
||||||
static char * expand_home(const char *home, const char *path)
|
static char * expand_home(const char *home, const char *path)
|
||||||
{
|
{
|
||||||
char *opath, *ppath, *p, *nh;
|
char *opath, *ppath, *p, *nh;
|
||||||
@ -457,6 +467,7 @@ static void supervisor(char *exec, char **argv)
|
|||||||
signal_setup_restart(SIGPIPE, handle_signal);
|
signal_setup_restart(SIGPIPE, handle_signal);
|
||||||
signal_setup_restart(SIGALRM, handle_signal);
|
signal_setup_restart(SIGALRM, handle_signal);
|
||||||
signal_setup(SIGTERM, handle_signal);
|
signal_setup(SIGTERM, handle_signal);
|
||||||
|
signal_setup(SIGCHLD, reap_zombies);
|
||||||
signal_setup_restart(SIGUSR1, handle_signal);
|
signal_setup_restart(SIGUSR1, handle_signal);
|
||||||
signal_setup_restart(SIGUSR2, handle_signal);
|
signal_setup_restart(SIGUSR2, handle_signal);
|
||||||
signal_setup_restart(SIGBUS, handle_signal);
|
signal_setup_restart(SIGBUS, handle_signal);
|
||||||
|
Loading…
Reference in New Issue
Block a user