diff options
Diffstat (limited to 'src/core/exec-invoke.c')
-rw-r--r-- | src/core/exec-invoke.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index 61f66b6914..0475a3cc3c 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -670,12 +670,8 @@ static int chown_terminal(int fd, uid_t uid) { assert(fd >= 0); /* Before we chown/chmod the TTY, let's ensure this is actually a tty */ - if (isatty(fd) < 1) { - if (IN_SET(errno, EINVAL, ENOTTY)) - return 0; /* not a tty */ - - return -errno; - } + if (!isatty_safe(fd)) + return 0; /* This might fail. What matters are the results. */ r = fchmod_and_chown(fd, TTY_MODE, uid, GID_INVALID); |