nix-daemon: preserve errno in signal handler (thanks tsan)
This commit is contained in:
parent
55aa622fb1
commit
d98755b0c2
1 changed files with 3 additions and 0 deletions
|
@ -816,8 +816,11 @@ static void processConnection(bool trusted)
|
||||||
|
|
||||||
static void sigChldHandler(int sigNo)
|
static void sigChldHandler(int sigNo)
|
||||||
{
|
{
|
||||||
|
// Ensure we don't modify errno of whatever we've interrupted
|
||||||
|
auto saved_errno = errno;
|
||||||
/* Reap all dead children. */
|
/* Reap all dead children. */
|
||||||
while (waitpid(-1, 0, WNOHANG) > 0) ;
|
while (waitpid(-1, 0, WNOHANG) > 0) ;
|
||||||
|
errno = saved_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue