From: Marco d'Itri Date: Wed, 25 Jan 2012 19:14:26 +0100 Subject: [PATCH] always_setsid always create a new process group pppd sends signals to the whole process group, so it must always create a new one or it may kill the parent process and its siblings. Currently setsid() is not called when the updetach option is used. We want to make the detached and non-detached code paths as similar as possible. http://ppp.samba.org/cgi-bin/ppp-bugs/incoming?id=1411 http://ppp.samba.org/cgi-bin/ppp-bugs/incoming?id=1589 --- pppd/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pppd/main.c b/pppd/main.c index 014d614..58a5bdb 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -431,6 +431,13 @@ main(argc, argv) } /* + * pppd sends signals to the whole process group, so it must always + * create a new one or it may kill the parent process and its siblings. + */ + setsid(); + chdir("/"); + + /* * Initialize system-dependent stuff. */ sys_init(); @@ -774,8 +781,6 @@ detach() create_linkpidfile(pid); exit(0); /* parent dies */ } - setsid(); - chdir("/"); dup2(fd_devnull, 0); dup2(fd_devnull, 1); dup2(fd_devnull, 2);