mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 16:34:45 +07:00
Fix for unwanted zombies ...
When receiving SIGCHLD we must reap *all* children. We only receive one signal, but multiple processes may have exited. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -118,7 +118,16 @@ static void sigint_cb(uev_ctx_t *UNUSED(ctx), uev_t *w, void *UNUSED(arg), int U
|
||||
*/
|
||||
static void sigchld_cb(uev_ctx_t *UNUSED(ctx), uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
{
|
||||
svc_monitor(waitpid(-1, NULL, WNOHANG));
|
||||
pid_t pid;
|
||||
|
||||
/* Reap all the children! */
|
||||
do {
|
||||
pid = waitpid(-1, NULL, WNOHANG);
|
||||
if (pid > 0) {
|
||||
_d("Collected child %d", pid);
|
||||
svc_monitor(pid);
|
||||
}
|
||||
} while (pid > 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user