diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-08 07:41:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-08 07:41:38 +0000 |
commit | a2f1c07fe4aa2e9cd2db0a21f3ee8b6488cdbeab (patch) | |
tree | 705e044948fef217f079dbfe268ae3cd4552c998 | |
parent | 269b795556d1befc13fc2e44e3a1dd5ec2fb7950 (diff) | |
download | ruby-a2f1c07fe4aa2e9cd2db0a21f3ee8b6488cdbeab.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | signal.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -629,9 +629,11 @@ ruby_signal(int signum, sighandler_t handler) 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) 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, sighandler_t handler) 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) 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 |