diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2022-01-13 00:04:13 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2022-01-13 00:04:13 +0000 |
commit | 0840786b5826d81b447e4cd4292f0615b17a15ae (patch) | |
tree | aefb4437479e1a69f254b33d54f7e384a1764105 /src/init/s6-linux-init.c | |
parent | fafa34059864fb8985d66243270c1e72609d4762 (diff) | |
download | s6-linux-init-0840786b5826d81b447e4cd4292f0615b17a15ae.tar.xz |
Get the supervision tree rid of any control terminal
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/init/s6-linux-init.c')
-rw-r--r-- | src/init/s6-linux-init.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/init/s6-linux-init.c b/src/init/s6-linux-init.c index bb24a52..e88bccf 100644 --- a/src/init/s6-linux-init.c +++ b/src/init/s6-linux-init.c @@ -99,7 +99,7 @@ static inline void run_stage2 (char const *basedir, char const **argv, unsigned for (unsigned int i = 0 ; i < argc ; i++) childargv[i+2] = argv[i] ; childargv[argc + 2] = 0 ; - setsid() ; + if (!inns) setsid() ; if (nologger) { close(notifpipe[1]) ; @@ -178,7 +178,6 @@ int main (int argc, char const **argv, char const *const *envp) else if (hasconsole) allwrite(1, BANNER, sizeof(BANNER) - 1) ; if (chdir("/") == -1) strerr_diefu1sys(111, "chdir to /") ; umask(mask) ; - setpgid(0, 0) ; close(0) ; if (slashdev) @@ -273,6 +272,7 @@ int main (int argc, char const **argv, char const *const *envp) pid = fork() ; if (pid == -1) strerr_diefu1sys(111, "fork") ; if (!pid) run_stage2(basedir, argv, argc, newenvp, !!path, envmodifs.s, envmodifs.len, initdefault) ; + setsid() ; if (nologger) { close(notifpipe[0]) ; |