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 04cc8ce9ac
commit 8ad278b088
1 changed files with 7 additions and 2 deletions

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
*/