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 static void
sigchld_handler(int sig) sigchld_handler(int sig)
{ {
int status; int status, olderrno;
waitpid(-1, &status, WNOHANG);
olderrno = errno;
while (waitpid(-1, &status, WNOHANG) > 0)
;
errno = olderrno;
} }
/* /*
* sigterm_handler - exit the server * sigterm_handler - exit the server
*/ */