Project

General

Profile

Bug #9878

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

`ruby_signal()` `ruby_signa()` in signal.c returns `old.sa_handler`, old.sa_handler,
but it should return either `old.sa_sigaction` old.sa_sigaction or `old.sa_handler`, old.sa_handler,
depending on whether `SA_SIGINFO` SA_SIGINFO is set in `old.sa_flags`. old.sa_flags.

~~~diff ~~~
--- signal.c (revision 46222)
+++ signal.c (working copy)
@@ -595,7 +595,10 @@
rb_bug_errno("sigaction", errno);
}
}
- return old.sa_handler;
+ if (old.sa_flags & SA_SIGINFO)
+ return (sighandler_t)old.sa_sigaction;
+ else
+ return old.sa_handler;
}

sighandler_t
~~~

The original code happens to be correct on the environments
where `sa_handler` sa_handler and `sa_sigaction` sa_sigaction are union, but it is not
guaranteed in general.

(Actually, they are not union on z/OS.)

Back