mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	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
					
				
					 2 changed files with 3 additions and 26 deletions
				
			
		
							
								
								
									
										23
									
								
								process.c
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								process.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1136,30 +1136,10 @@ proc_detach(VALUE obj, VALUE 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. */
 | 
			
		||||
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)
 | 
			
		|||
static void
 | 
			
		||||
after_exec_async_signal_safe(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef SIGPIPE
 | 
			
		||||
    signal(SIGPIPE, saved_sigpipe_handler); /* async-signal-safe */
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								signal.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								signal.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -935,7 +935,7 @@ check_reserved_signal_(const char *name, size_t name_len)
 | 
			
		|||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef SIGSYS
 | 
			
		||||
#if defined SIGPIPE || defined SIGSYS
 | 
			
		||||
static RETSIGTYPE
 | 
			
		||||
sig_do_nothing(int sig)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -1066,7 +1066,7 @@ default_handler(int sig)
 | 
			
		|||
#endif
 | 
			
		||||
#ifdef SIGPIPE
 | 
			
		||||
      case SIGPIPE:
 | 
			
		||||
        func = SIG_IGN;
 | 
			
		||||
        func = sig_do_nothing;
 | 
			
		||||
        break;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef SIGSYS
 | 
			
		||||
| 
						 | 
				
			
			@ -1487,7 +1487,7 @@ Init_signal(void)
 | 
			
		|||
#endif
 | 
			
		||||
    }
 | 
			
		||||
#ifdef SIGPIPE
 | 
			
		||||
    install_sighandler(SIGPIPE, SIG_IGN);
 | 
			
		||||
    install_sighandler(SIGPIPE, sig_do_nothing);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef SIGSYS
 | 
			
		||||
    install_sighandler(SIGSYS, sig_do_nothing);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue