summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Osterried <thomas@osterried.de>2011-08-18 10:43:49 +0000
committerThomas Osterried <thomas@osterried.de>2011-08-18 10:43:49 +0000
commit8cb88af8894399f3b68f9e027f8f6f4fc5575686 (patch)
tree40d20f86e6f6307b8d4c57bc0f767f38728fc28a
parente669f13ba6ec43ef560373064b0494a80a0e569b (diff)
call setsid() only if we are not already the process group leader
-rw-r--r--ax25/axspawn.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ax25/axspawn.c b/ax25/axspawn.c
index 5e6f8a1..5d0cfac 100644
--- a/ax25/axspawn.c
+++ b/ax25/axspawn.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: axspawn.c,v 1.26 2011/08/18 10:21:27 dl9sau Exp $
+ * $Id: axspawn.c,v 1.27 2011/08/18 10:43:49 dl9sau Exp $
*
* axspawn.c - run a program from ax25d.
*
@@ -1693,7 +1693,11 @@ again:
pututline(&ut_line);
endutent();
- setsid();
+ /* become process group leader, if we not already are */
+ if (getpid() != getsid(0)) {
+ if (setsid() == -1)
+ exit(1);
+ }
chargc = 0;
envc = 0;