mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2026-02-05 18:20:32 +03:00
Merge pull request #2217 from synqa/fix-preserve-errno
Fix preserve errno in SIGCHLD signal handler
This commit is contained in:
@ -2140,9 +2140,13 @@ void UnixMemoryFree(void *addr)
|
|||||||
// SIGCHLD handler
|
// SIGCHLD handler
|
||||||
void UnixSigChldHandler(int sig)
|
void UnixSigChldHandler(int sig)
|
||||||
{
|
{
|
||||||
|
int old_errno = errno;
|
||||||
|
|
||||||
// Recall the zombie processes
|
// Recall the zombie processes
|
||||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||||
signal(SIGCHLD, UnixSigChldHandler);
|
signal(SIGCHLD, UnixSigChldHandler);
|
||||||
|
|
||||||
|
errno = old_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable core dump
|
// Disable core dump
|
||||||
|
|||||||
Reference in New Issue
Block a user