diff options
Diffstat (limited to 'src/nix-worker/main.cc')
-rw-r--r-- | src/nix-worker/main.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nix-worker/main.cc b/src/nix-worker/main.cc index fef2c2958aa9..cf550895e4b2 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); } |