summaryrefslogtreecommitdiff
path: root/daemons
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-08-15 09:37:54 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-08-29 00:13:14 +0200
commit7f76449a4f7b2d027fa6c085ba931129e16f4fb4 (patch)
tree6277db57da98af8df61939bb52f34c7b172da95a /daemons
parent0845794f5884d41429f49ff248011c67581e61f2 (diff)
daemons: fix setsid(2) in console-run
Only run setsid(2) if the process is not already the group leader. * daemons/console-run.c (open_console): Fix setsid(2).
Diffstat (limited to 'daemons')
-rw-r--r--daemons/console-run.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/daemons/console-run.c b/daemons/console-run.c
index fb879e53..e1bfe642 100644
--- a/daemons/console-run.c
+++ b/daemons/console-run.c
@@ -217,8 +217,9 @@ open_console (char **namep)
dup2 (0, 1);
dup2 (0, 2);
- if (setsid () == -1)
- error (0, errno, "setsid");
+ if (getsid (0) != getpid ())
+ if (setsid () == -1)
+ error (0, errno, "setsid");
/* Set the console to our pgrp. */
tcsetpgrp (0, getpid ());