commit: 008c9d0036e348242e323c0b5a66f3724b4a839d Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> AuthorDate: Tue Nov 6 03:35:00 2018 +0000 Commit: William Hubbs <williamh <AT> gentoo <DOT> org> CommitDate: Tue Nov 6 03:35:00 2018 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=008c9d00
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. src/rc/supervise-daemon.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index 883c738d..52525c19 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -197,6 +197,16 @@ static void healthcheck(int sig) 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) { 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(SIGALRM, handle_signal); signal_setup(SIGTERM, handle_signal); + signal_setup(SIGCHLD, reap_zombies); signal_setup_restart(SIGUSR1, handle_signal); signal_setup_restart(SIGUSR2, handle_signal); signal_setup_restart(SIGBUS, handle_signal);