revert r31760 and r31761
seems that rb_bug_errno() is called in sigpipe() intentionally. https://gist.github.com/sorah/831169 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
38e62df9f6
commit
46b39cb0ba
23
process.c
23
process.c
@ -1136,30 +1136,10 @@ proc_detach(VALUE obj, VALUE pid)
|
|||||||
return rb_detach_process(NUM2PIDT(pid));
|
return rb_detach_process(NUM2PIDT(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SIGPIPE
|
|
||||||
static RETSIGTYPE (*saved_sigpipe_handler)(int) = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SIGPIPE
|
|
||||||
static RETSIGTYPE
|
|
||||||
sig_do_nothing(int sig)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function should be async-signal-safe. Actually it is. */
|
/* This function should be async-signal-safe. Actually it is. */
|
||||||
static void
|
static void
|
||||||
before_exec_async_signal_safe(void)
|
before_exec_async_signal_safe(void)
|
||||||
{
|
{
|
||||||
#ifdef SIGPIPE
|
|
||||||
/*
|
|
||||||
* Some OS commands don't initialize signal handler properly. Thus we have
|
|
||||||
* to reset signal handler before exec(). Otherwise, system() and similar
|
|
||||||
* child process interaction might fail. (e.g. ruby -e "system 'yes | ls'")
|
|
||||||
* [ruby-dev:12261]
|
|
||||||
*/
|
|
||||||
saved_sigpipe_handler = signal(SIGPIPE, sig_do_nothing); /* async-signal-safe */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1186,9 +1166,6 @@ before_exec(void)
|
|||||||
static void
|
static void
|
||||||
after_exec_async_signal_safe(void)
|
after_exec_async_signal_safe(void)
|
||||||
{
|
{
|
||||||
#ifdef SIGPIPE
|
|
||||||
signal(SIGPIPE, saved_sigpipe_handler); /* async-signal-safe */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
6
signal.c
6
signal.c
@ -935,7 +935,7 @@ check_reserved_signal_(const char *name, size_t name_len)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIGSYS
|
#if defined SIGPIPE || defined SIGSYS
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
sig_do_nothing(int sig)
|
sig_do_nothing(int sig)
|
||||||
{
|
{
|
||||||
@ -1066,7 +1066,7 @@ default_handler(int sig)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef SIGPIPE
|
#ifdef SIGPIPE
|
||||||
case SIGPIPE:
|
case SIGPIPE:
|
||||||
func = SIG_IGN;
|
func = sig_do_nothing;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGSYS
|
#ifdef SIGSYS
|
||||||
@ -1487,7 +1487,7 @@ Init_signal(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef SIGPIPE
|
#ifdef SIGPIPE
|
||||||
install_sighandler(SIGPIPE, SIG_IGN);
|
install_sighandler(SIGPIPE, sig_do_nothing);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGSYS
|
#ifdef SIGSYS
|
||||||
install_sighandler(SIGSYS, sig_do_nothing);
|
install_sighandler(SIGSYS, sig_do_nothing);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user