diff options
author | Christian Persch <chpe@src.gnome.org> | 2019-08-03 19:01:13 +0200 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2019-08-03 19:01:13 +0200 |
commit | 6e640d5efd2d9427f6dac3dace60ddca3f8afb0c (patch) | |
tree | b6ace92d97d01719a5478e7de652abd90045de4d | |
parent | 2eb1707ca0f0c0b19a1d6d03ca364d183eca2e61 (diff) | |
download | vte-6e640d5efd2d9427f6dac3dace60ddca3f8afb0c.tar.gz |
pty: Use O_NOCTTY when VTE_PTY_NOCTTY is set
-rw-r--r-- | src/pty.cc | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -158,6 +158,9 @@ vte_pty_child_setup (VtePty *pty) _exit(127); } + /* Note: *not* O_CLOEXEC! */ + auto const fd_flags = O_RDWR | ((priv->flags & VTE_PTY_NO_CTTY) ? O_NOCTTY : 0); + char *name = ptsname(masterfd); if (name == nullptr) { _vte_debug_print(VTE_DEBUG_PTY, "%s failed: %m\n", "ptsname"); @@ -168,7 +171,7 @@ vte_pty_child_setup (VtePty *pty) "Setting up child pty: master FD = %d name = %s\n", masterfd, name); - int fd = open(name, O_RDWR); + int fd = open(name, fd_flags); if (fd == -1) { _vte_debug_print (VTE_DEBUG_PTY, "Failed to open PTY: %m\n"); _exit(127); |