aboutsummaryrefslogtreecommitdiff
path: root/src/nix-worker/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-03 00:52:27 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-03 00:52:27 +0000
commit714fa24cfb5afeb144549e0cc4808cc2a1c459cf (patch)
tree97faccbf4a0390ee2452a313a5d34cad70e45458 /src/nix-worker/main.cc
parente25fad691aa3ccb492c4fb8840289f76151e553e (diff)
* Run the worker in a separate session to prevent terminal signals
from interfering.
Diffstat (limited to 'src/nix-worker/main.cc')
-rw-r--r--src/nix-worker/main.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nix-worker/main.cc b/src/nix-worker/main.cc
index fef2c2958..cf550895e 100644
--- a/src/nix-worker/main.cc
+++ b/src/nix-worker/main.cc
@@ -164,6 +164,12 @@ void run(Strings args)
if (slave) {
FdSource source(STDIN_FILENO);
FdSink sink(STDOUT_FILENO);
+
+ /* This prevents us from receiving signals from the terminal
+ when we're running in setuid mode. */
+ if (setsid() == -1)
+ throw SysError(format("creating a new session"));
+
processConnection(source, sink);
}