mirror of
https://github.com/troglobit/finit.git
synced 2026-11-09 16:21:24 +00: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:
1 parent
cb075560ed
commit
2cba0c73be
1 file changed
+10
-1
@@ -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))
|
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