[gnome-terminal/gnome-3-10] screen: Only remove the CLOEXEC flag
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal/gnome-3-10] screen: Only remove the CLOEXEC flag
- Date: Sat, 14 Sep 2013 11:20:32 +0000 (UTC)
commit db5644aa494665eb9d9a2e978368d88a24a4c24c
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.
(cherry picked from commit 62a9cb16b938a3146065fb5af8754d24abfaecc6)
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 9535866..a5829b9 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1348,8 +1348,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]