[前][次][番号順一覧][スレッド一覧]

ruby-changes:39309

From: nobu <ko1@a...>
Date: Sun, 26 Jul 2015 14:38:12 +0900 (JST)
Subject: [ruby-changes:39309] nobu:r51390 (trunk): revert r31760 and r31761

nobu	2015-07-26 14:37:59 +0900 (Sun, 26 Jul 2015)

  New Revision: 51390

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51390

  Log:
    revert r31760 and r31761
    
    seems that rb_bug_errno() is called in sigpipe() intentionally.
    https://gist.github.com/sorah/831169

  Modified files:
    trunk/process.c
    trunk/signal.c
Index: process.c
===================================================================
--- process.c	(revision 51389)
+++ process.c	(revision 51390)
@@ -1136,30 +1136,10 @@ proc_detach(VALUE obj, VALUE pid) https://github.com/ruby/ruby/blob/trunk/process.c#L1136
     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. */
 static 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
@@ -1186,9 +1166,6 @@ before_exec(void) https://github.com/ruby/ruby/blob/trunk/process.c#L1166
 static void
 after_exec_async_signal_safe(void)
 {
-#ifdef SIGPIPE
-    signal(SIGPIPE, saved_sigpipe_handler); /* async-signal-safe */
-#endif
 }
 
 static void
Index: signal.c
===================================================================
--- signal.c	(revision 51389)
+++ signal.c	(revision 51390)
@@ -935,7 +935,7 @@ check_reserved_signal_(const char *name, https://github.com/ruby/ruby/blob/trunk/signal.c#L935
 }
 #endif
 
-#ifdef SIGSYS
+#if defined SIGPIPE || defined SIGSYS
 static RETSIGTYPE
 sig_do_nothing(int sig)
 {
@@ -1066,7 +1066,7 @@ default_handler(int sig) https://github.com/ruby/ruby/blob/trunk/signal.c#L1066
 #endif
 #ifdef SIGPIPE
       case SIGPIPE:
-        func = SIG_IGN;
+        func = sig_do_nothing;
         break;
 #endif
 #ifdef SIGSYS
@@ -1487,7 +1487,7 @@ Init_signal(void) https://github.com/ruby/ruby/blob/trunk/signal.c#L1487
 #endif
     }
 #ifdef SIGPIPE
-    install_sighandler(SIGPIPE, SIG_IGN);
+    install_sighandler(SIGPIPE, sig_do_nothing);
 #endif
 #ifdef SIGSYS
     install_sighandler(SIGSYS, sig_do_nothing);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]