From 714fa24cfb5afeb144549e0cc4808cc2a1c459cf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 3 Dec 2006 00:52:27 +0000 Subject: * Run the worker in a separate session to prevent terminal signals from interfering. --- src/nix-worker/main.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nix-worker/main.cc') 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); } -- cgit 1.4.1