summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/execute.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 2cef70e668..e718c43df9 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -552,6 +552,10 @@ 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)
+ return 0;
+
/* This might fail. What matters are the results. */
(void) fchown(fd, uid, -1);
(void) fchmod(fd, TTY_MODE);