summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-02-20 13:59:35 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-02-20 13:59:35 +0100
commite88fc334835a4669d1dd27f7156ceb720a3eafb0 (patch)
tree455bf5ab45a6498fce44388b5fceeb94f269a1d0 /src
parent93b11cab322a5543a5f748bc4f70246abe5dace6 (diff)
downloadratpoison-e88fc334835a4669d1dd27f7156ceb720a3eafb0.zip
Only call setpgid when setsid fails or is absent.
Diffstat (limited to 'src')
-rw-r--r--src/actions.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/actions.c b/src/actions.c
index 24cb62f..79db068 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -2646,13 +2646,17 @@ spawn(char *cmd, int raw, rp_frame *frame)
in its own session. */
putenv(current_screen()->display_string);
#ifdef HAVE_SETSID
- setsid();
+ if (setsid() == -1)
#endif
+ {
#if defined (HAVE_SETPGID)
- setpgid (0, 0);
+ setpgid (0, 0);
#elif defined (HAVE_SETPGRP)
- setpgrp (0, 0);
+ /* Assume BSD-style setpgrp */
+ setpgrp (0, 0);
#endif
+ }
+
/* raw means don't run it through sh. */
if (raw)
execl (cmd, cmd, NULL);