about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-03-15T02·39-0500
committerWill Dietz <w@wdtz.org>2018-03-15T02·39-0500
commitd98755b0c291fed59c71957ac8dbe4ee94e58b10 (patch)
tree17692165be3707f90033d62aa8962c597832fb1b /src
parent55aa622fb1ae01a8a939fa32f71e7eed50afbbf9 (diff)
nix-daemon: preserve errno in signal handler (thanks tsan)
Diffstat (limited to 'src')
-rw-r--r--src/nix-daemon/nix-daemon.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 890bffa19aa5..30e2b54552ee 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -816,8 +816,11 @@ static void processConnection(bool trusted)
 
 static void sigChldHandler(int sigNo)
 {
+    // Ensure we don't modify errno of whatever we've interrupted
+    auto saved_errno = errno;
     /* Reap all dead children. */
     while (waitpid(-1, 0, WNOHANG) > 0) ;
+    errno = saved_errno;
 }