mirror of
https://github.com/nmap/nmap.git
synced 2026-10-24 04:43:03 +00:00
Save and restore errno in sigchld_handler()
waitpid() can set errno, which might hide an error from the main thread when running the signal handler.
This commit is contained in:
parent
49a85f9c3c
commit
954a712666
1 changed files with 2 additions and 0 deletions
|
|
@ -173,8 +173,10 @@ static int get_conn_count(void)
|
|||
#ifndef WIN32
|
||||
static void sigchld_handler(int signum)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0)
|
||||
decrease_conn_count();
|
||||
errno = saved_errno;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue