ruby-changes:46931
From: nobu <ko1@a...>
Date: Thu, 8 Jun 2017 16:41:46 +0900 (JST)
Subject: [ruby-changes:46931] nobu:r59046 (trunk): signal.c: relax installation failure
nobu 2017-06-08 16:41:38 +0900 (Thu, 08 Jun 2017) New Revision: 59046 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59046 Log: signal.c: relax installation failure * signal.c (install_sighandler): ignore failure at unreserved signals. e.g., SIGUSR2 fails under valgrind. * signal.c (install_sighandler_fail): refine [BUG] message. Modified files: trunk/signal.c Index: signal.c =================================================================== --- signal.c (revision 59045) +++ signal.c (revision 59046) @@ -629,9 +629,11 @@ ruby_signal(int signum, sighandler_t han https://github.com/ruby/ruby/blob/trunk/signal.c#L629 return SIG_ERR; } if (old.sa_flags & SA_SIGINFO) - return (sighandler_t)old.sa_sigaction; + handler = (sighandler_t)old.sa_sigaction; else - return old.sa_handler; + handler = old.sa_handler; + ASSUME(handler != SIG_ERR); + return handler; } sighandler_t @@ -1384,6 +1386,7 @@ sig_list(void) https://github.com/ruby/ruby/blob/trunk/signal.c#L1386 return h; } +#define install_sighandler_fail(signum) rb_bug("failed to install "signum" handler") static int install_sighandler(int signum, sighandler_t handler) { @@ -1398,7 +1401,9 @@ install_sighandler(int signum, sighandle https://github.com/ruby/ruby/blob/trunk/signal.c#L1401 return 0; } #ifndef __native_client__ -# define install_sighandler(signum, handler) (install_sighandler(signum, handler) ? rb_bug(#signum) : (void)0) +# define install_sighandler(signum, handler) \ + (install_sighandler(signum, handler) && reserved_signal_p(signum) ? \ + install_sighandler_fail(#signum) : (void)0) #endif #if defined(SIGCLD) || defined(SIGCHLD) @@ -1418,7 +1423,8 @@ init_sigchld(int sig) https://github.com/ruby/ruby/blob/trunk/signal.c#L1423 return 0; } # ifndef __native_client__ -# define init_sigchld(signum) (init_sigchld(signum) ? rb_bug(#signum) : (void)0) +# define init_sigchld(signum) \ + (init_sigchld(signum) ? install_sighandler_fail(#signum) : (void)0) # endif #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/