diff --git a/ncat/ncat_listen.c b/ncat/ncat_listen.c index 67ec811e8..2064eaa42 100644 --- a/ncat/ncat_listen.c +++ b/ncat/ncat_listen.c @@ -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