diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-04-29 03:22:13 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-04-29 03:22:13 +0000 |
commit | 3be1f17208a1e3d48c1c0607bff50402bc45ceb3 (patch) | |
tree | d72b182ff81fbc50e87c382f72494aac9bb46af6 /src/init | |
parent | 1acd4252b0aefaa03d227217828a8b69d3cf3a87 (diff) | |
download | s6-linux-init-3be1f17208a1e3d48c1c0607bff50402bc45ceb3.tar.xz |
Prepare for 1.1.1.1; fix ctty passing when we have a logger
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/init')
-rw-r--r-- | src/init/s6-linux-init.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/init/s6-linux-init.c b/src/init/s6-linux-init.c index 699b89f..103c233 100644 --- a/src/init/s6-linux-init.c +++ b/src/init/s6-linux-init.c @@ -204,10 +204,10 @@ int main (int argc, char const **argv, char const *const *envp) if (r) strerr_warnw1x("parent wrote to fd 3!") ; close(3) ; } - if (!slashdev && hasconsole && isatty(1)) + if (!slashdev && hasconsole && isatty(2 - nologger)) { - tty = ttyname(1) ; - if (!tty) strerr_warnwu1sys("ttyname stdout") ; + tty = ttyname(2 - nologger) ; + if (!tty) strerr_warnwu2sys("ttyname std", nologger ? "err" : "out") ; } } else if (hasconsole) allwrite(1, BANNER, sizeof(BANNER) - 1) ; @@ -300,7 +300,7 @@ int main (int argc, char const **argv, char const *const *envp) newenvp[0] = pathvar ; } if (nologger && pipe(notifpipe) < 0) strerr_diefu1sys(111, "pipe") ; - if (tty && !slashdev && ioctl(1, TIOCNOTTY) == -1) strerr_warnwu1sys("relinquish control terminal") ; + if (tty && !slashdev && ioctl(2 - nologger, TIOCNOTTY) == -1) strerr_warnwu1sys("relinquish control terminal") ; pid = fork() ; if (pid == -1) strerr_diefu1sys(111, "fork") ; |