* Run the worker in a separate session to prevent terminal signals

from interfering.
This commit is contained in:
Eelco Dolstra 2006-12-03 00:52:27 +00:00
parent e25fad691a
commit 714fa24cfb

View file

@ -164,6 +164,12 @@ void run(Strings args)
if (slave) { if (slave) {
FdSource source(STDIN_FILENO); FdSource source(STDIN_FILENO);
FdSink sink(STDOUT_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); processConnection(source, sink);
} }