[gnome-terminal] screen: Only remove the CLOEXEC flag



commit 62a9cb16b938a3146065fb5af8754d24abfaecc6
Author: Christian Persch <chpe gnome org>
Date:   Thu Sep 12 19:42:07 2013 +0200

    screen: Only remove the CLOEXEC flag
    
    Don't clear all flags.

 src/terminal-screen.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 948b822..f226a66 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1223,8 +1223,16 @@ terminal_screen_child_setup (FDSetupData *data)
 
     if (target_fd == fds[idx]) {
       /* Remove FD_CLOEXEC from target_fd */
+      int flags;
+
+      do {
+        flags = fcntl (target_fd, F_GETFD);
+      } while (flags == -1 && errno == EINTR);
+      if (flags == -1)
+        _exit (127);
+
       do {
-        r = fcntl (target_fd, F_SETFD, 0 /* no FD_CLOEXEC */);
+        r = fcntl (target_fd, F_SETFD, flags & ~FD_CLOEXEC);
       } while (r == -1 && errno == EINTR);
       if (r == -1)
         _exit (127);


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