From cebc9bb19d219aaf5d035ff2d0e5fb69636bd2c1 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 15 Jun 2007 09:58:10 +0000 Subject: * signal.c (trap_handler): trap("SIGSEGV", "DEFAULT") may cause wrong trap error because SIG_DFL may be zero. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 ++++++- signal.c | 13 +++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f7b9d2768..d55ef42ea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ +Fri Jun 15 18:56:52 2007 Tanaka Akira + + * signal.c (trap_handler): trap("SIGSEGV", "DEFAULT") may cause wrong + trap error because SIG_DFL may be zero. + Fri Jun 15 15:55:55 2007 Koichi Sasada - * insns.def(setconstant, toregexp): fix to mark object correctly. + * insns.def (setconstant, toregexp): fix to mark object correctly. Fri Jun 15 13:24:18 2007 Koichi Sasada diff --git a/signal.c b/signal.c index 3f104b1854..ddb8dd97d3 100644 --- a/signal.c +++ b/signal.c @@ -634,10 +634,15 @@ struct trap_arg { VALUE cmd; }; +static RETSIGTYPE +wrong_trap(int sig) +{ +} + static sighandler_t trap_handler(VALUE *cmd) { - sighandler_t func = 0; + sighandler_t func = wrong_trap; VALUE command; if (NIL_P(*cmd)) { @@ -674,7 +679,7 @@ trap_handler(VALUE *cmd) } break; } - if (!func) { + if (func == wrong_trap) { rb_raise(rb_eArgError, "wrong trap - %s", RSTRING_PTR(command)); } } @@ -1047,14 +1052,10 @@ Init_signal(void) #endif #ifdef SIGBUS -# ifndef RUBY_GC_STRESS install_sighandler(SIGBUS, sigbus); -# endif #endif #ifdef SIGSEGV -# ifndef RUBY_GC_STRESS install_sighandler(SIGSEGV, sigsegv); -# endif #endif #ifdef SIGPIPE install_sighandler(SIGPIPE, sigpipe); -- cgit v1.2.3