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
This commit is contained in:
Lennart Poettering 2016-10-11 20:07:22 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent f68c9dd5c6
commit e0d2adfde6
1 changed files with 1 additions and 1 deletions

View File

@ -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;