summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-20 13:55:04 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-20 13:55:04 +0000
commit1d110a14a44dce8a34be74821490a0ce303a64dd (patch)
treed93823b3ab3eff40639e8b0c74b92d041e8940ba /process.c
parent2552e428f3f89adbec3a548cf7b943b6b1318c24 (diff)
* process.c (before_exec): use sig_do_nothing instead of SIG_DFL
for avoiding a race. * process.c (sig_do_nothing): new function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/process.c b/process.c
index 16ac91cb72..4595ccf7b7 100644
--- a/process.c
+++ b/process.c
@@ -984,6 +984,12 @@ static RETSIGTYPE (*saved_sigpipe_handler)(int) = 0;
# define signal(a,b) posix_signal((a),(b))
#endif
+#ifdef SIGPIPE
+static RETSIGTYPE sig_do_nothing(int sig)
+{
+}
+#endif
+
static void before_exec(void)
{
/*
@@ -999,7 +1005,7 @@ static void before_exec(void)
* child process interaction might fail. (e.g. ruby -e "system 'yes | ls'")
* [ruby-dev:12261]
*/
- saved_sigpipe_handler = signal(SIGPIPE, SIG_DFL);
+ saved_sigpipe_handler = signal(SIGPIPE, sig_do_nothing);
#endif
if (!forked_child) {