From d98755b0c291fed59c71957ac8dbe4ee94e58b10 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Wed, 14 Mar 2018 21:39:01 -0500 Subject: nix-daemon: preserve errno in signal handler (thanks tsan) --- src/nix-daemon/nix-daemon.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nix-daemon/nix-daemon.cc') diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc index 890bffa19..30e2b5455 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; } -- cgit v1.2.3