Improve SIGCHLD handler

- Reap multiple zombies per signal
- Save and restore errno
ircd-ratbox r25239
This commit is contained in:
Jilles Tjoelker 2008-04-18 01:01:38 +02:00
parent 8e2ebdb80a
commit 3eabb958a7

View file

@ -43,9 +43,14 @@ dummy_handler(int sig)
static void
sigchld_handler(int sig)
{
int status;
waitpid(-1, &status, WNOHANG);
int status, olderrno;
olderrno = errno;
while (waitpid(-1, &status, WNOHANG) > 0)
;
errno = olderrno;
}
/*
* sigterm_handler - exit the server
*/