From: Lennart Poettering Date: Tue, 11 Oct 2016 18:07:22 +0000 (+0200) Subject: core: chown() any TTY used for stdin, not just when StandardInput=tty is used (#4347) X-Git-Tag: v232~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0d2adfde677d91b57dd63f6a3f00f4b86be9a64;p=thirdparty%2Fsystemd.git core: chown() any TTY used for stdin, not just when StandardInput=tty is used (#4347) If stdin is supplied as an fd for transient units (using the StandardInputFileDescriptor pseudo-property for transient units), then we should also fix up the TTY ownership, not just when we opened the TTY ourselves. This simply drops the explicit is_terminal_input()-based check. Note that chown_terminal() internally does a much more appropriate isatty()-based check anyway, hence we can drop this without replacement. Fixes: #4260 --- diff --git a/src/core/execute.c b/src/core/execute.c index 7079aeed6e9..0c983f4953d 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -2350,7 +2350,7 @@ static int exec_child( USER_PROCESS, username ? "root" : context->user); - if (context->user && is_terminal_input(context->std_input)) { + if (context->user) { r = chown_terminal(STDIN_FILENO, uid); if (r < 0) { *exit_status = EXIT_STDIN;