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.
This commit is contained in:
Lennart Poettering 2015-10-07 20:08:49 +02:00
parent c379f143a5
commit 660021d371
1 changed files with 1 additions and 1 deletions

View File

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