[gnome-builder] io: specify O_NOCTTY during child PTY creation



commit 16bf23fb33ccf1d32a75626f440c67813651bf65
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 15 16:07:40 2019 -0700

    io: specify O_NOCTTY during child PTY creation
    
    When creating the child side of a PTY pair, we need to ensure that we do
    not allow the PTY to become the controlling terminal for the current
    process. We won't have one of those when run from shell, and we very much
    don't want this to become ours (or else we'll SIGHUP when it is closed).
    
    Fixes #971

 src/libide/io/ide-pty-intercept.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/io/ide-pty-intercept.c b/src/libide/io/ide-pty-intercept.c
index c498ce64f..40fbaa4f5 100644
--- a/src/libide/io/ide-pty-intercept.c
+++ b/src/libide/io/ide-pty-intercept.c
@@ -127,15 +127,15 @@ ide_pty_intercept_create_slave (IdePtyFd master_fd,
     return IDE_PTY_FD_INVALID;
 #endif
 
-  ret = open (name, O_RDWR | O_CLOEXEC | extra);
+  ret = open (name, O_NOCTTY | O_RDWR | O_CLOEXEC | extra);
 
   if (ret == IDE_PTY_FD_INVALID && errno == EINVAL)
     {
       gint flags;
 
-      ret = open (name, O_RDWR | O_CLOEXEC);
+      ret = open (name, O_NOCTTY | O_RDWR | O_CLOEXEC);
       if (ret == IDE_PTY_FD_INVALID && errno == EINVAL)
-        ret = open (name, O_RDWR);
+        ret = open (name, O_NOCTTY | O_RDWR);
 
       if (ret == IDE_PTY_FD_INVALID)
         return IDE_PTY_FD_INVALID;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]