From e88fc334835a4669d1dd27f7156ceb720a3eafb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Thu, 20 Feb 2014 13:59:35 +0100 Subject: Only call setpgid when setsid fails or is absent. --- src/actions.c | 10 +++++++--- 1 file 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); -- cgit v1.2.3