/* if parent gets a SIGCHLD, it will exit */ static void sig_chld(int sig) { int status; int rc = waitpid(monitored, &status, WNOHANG); if (rc == 0) { while ((rc = waitpid(-1, &status, WNOHANG)) > 0) { if (rc == monitored) priv_exit_rc_status(rc, status); } return; } priv_exit_rc_status(rc, status); }
/* if parent gets a SIGCHLD, it will exit */ static void sig_chld(int sig) { int status; int rc = waitpid(monitored, &status, WNOHANG); if (rc == 0) { while ((rc = waitpid(-1, &status, WNOHANG)) > 0) { if (rc == monitored) priv_exit_rc_status(rc, status); else log_debug("privsep", "unrelated process %d has died", rc); } return; } priv_exit_rc_status(rc, status); }
static void priv_exit() { int status; int rc; rc = waitpid(monitored, &status, WNOHANG); priv_exit_rc_status(rc, status); }