psmedley / gcc

GNU General Public License v2.0
7 stars 1 forks source link

sh hangs after finishing build #16

Closed komh closed 8 years ago

komh commented 9 years ago

sh does not quit even if build is finished.

Here is the patch.

From b2862e82ee425ae93aff6a337d249f756885888b Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Fri, 3 Jul 2015 19:46:14 +0900
Subject: [PATCH] OS/2: do not pass write_fd to the child

This causes the server shell to be frozen even if kill()ed on OS/2.

---
 fixincludes/procopen.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fixincludes/procopen.c b/fixincludes/procopen.c
index 22d4f67..272eaff 100644
--- a/fixincludes/procopen.c
+++ b/fixincludes/procopen.c
@@ -189,6 +189,9 @@ proc2_open (t_fd_pair* p_pair, tCC** pp_args)
   if (pipe ((int *) p_pair) < 0)
     return NOPROCESS;

+  /* Do not pass write_fd to the child */
+  fcntl(p_pair->write_fd, F_SETFD, FD_CLOEXEC);
+
   p_pair->read_fd = chain_open (p_pair->read_fd, pp_args, &ch_id);
   if (ch_id == NOPROCESS)
     close (p_pair->write_fd);
-- 
1.9.5
psmedley commented 9 years ago

I have added this patch for my local build of GCC 5.2.0

komh commented 8 years ago

Pushed as commit 553acd1d2637ad02732236c3db99c03c5645fe65.