Improve SIGCHLD handler
- Reap multiple zombies per signal - Save and restore errno ircd-ratbox r25239
This commit is contained in:
parent
8e2ebdb80a
commit
3eabb958a7
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue