summaryrefslogtreecommitdiff
path: root/src/basic/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-07 20:08:49 +0200
committerLennart Poettering <lennart@poettering.net>2015-10-07 20:08:49 +0200
commit660021d371d5698a86e914765239045a669e65fb (patch)
treedde8b208436a55e327ac9cd1bf7ba984366f067f /src/basic/util.c
parentc379f143a5ccdbc94a87cfca0174e7f21fa05f26 (diff)
util: always enforce O_NOCTTY and O_CLOEXEC in openpt_in_namespace()
The child process is shortliving, hence always set O_NOCTTY so that the tty doesn't quickly become controlling TTY and then gives it up again. Also set O_CLOEXEC, because it's cleaner, and doesn't affect the parent anyway.
Diffstat (limited to 'src/basic/util.c')
-rw-r--r--src/basic/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index 2855993afe..f845e2dabb 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -6143,7 +6143,7 @@ int openpt_in_namespace(pid_t pid, int flags) {
if (r < 0)
_exit(EXIT_FAILURE);
- master = posix_openpt(flags);
+ master = posix_openpt(flags|O_NOCTTY|O_CLOEXEC);
if (master < 0)
_exit(EXIT_FAILURE);