diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-09 23:13:59 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-09 23:22:15 +0900 |
commit | 891cbd66a411725d7300a28b1a95619c2902f0eb (patch) | |
tree | 58d4c2749523b7c1bc083d8686e6ce5cc02e5355 /error.c | |
parent | dd477df411691803fc5a83c7daa64faac112a0e4 (diff) | |
download | ruby-891cbd66a411725d7300a28b1a95619c2902f0eb.tar.gz |
signal.c: save the original sighandlers for fatal signals
On Android, a signal handler that is not SIG_DFL is set by default for
SIGSEGV. Ruby's install_sighandler inserts Ruby's handler only when the
signal has no handler, so it does not insert Ruby's SEGV report handler,
which caused some test failures.
This changeset forces to install Ruby's handler for some fatal signals
(sigbus, sigsegv, and sigill). They keep the original handlers, and
call them when the interpreter receives the signals.
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -599,7 +599,7 @@ rb_bug(const char *fmt, ...) } void -rb_bug_for_fatal_signal(const void *ctx, const char *fmt, ...) +rb_bug_for_fatal_signal(RETSIGTYPE (*default_sighandler)(int), int sig, const void *ctx, const char *fmt, ...) { const char *file = NULL; int line = 0; @@ -610,6 +610,8 @@ rb_bug_for_fatal_signal(const void *ctx, const char *fmt, ...) report_bug(file, line, fmt, ctx); + if (default_sighandler) default_sighandler(sig); + die(); } |