Actions
Bug #10866
closedA signal handler in signal.c can corrupt the value of errno.
Description
A signal handler in signal.c can corrupt the value of errno. This is
common mistake. It should save and restore errno as in the following
patch. I think this is the only signal handler used but I am not that
familiar with the code.
Index: signal.c¶
--- signal.c (revision 49641)
+++ signal.c (working copy)
@@ -688,11 +688,15 @@
static RETSIGTYPE
sighandler(int sig)
{
- int old_errnum = errno;
- signal_enque(sig);
rb_thread_wakeup_timer_thread();
#if !defined(BSD_SIGNAL) && !defined(POSIX_SIGNAL)
ruby_signal(sig, sighandler);
#endif - errno = old_errnum;
}
int
Updated by normalperson (Eric Wong) about 10 years ago
Good catch! I'll commit in a little bit in case we missed something,
but I think that's the only signal handler.
Updated by Anonymous about 10 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r49746.
signal.c: preserve errno
- signal.c (sighandler): preserve errno
Patch by Steven Stewart-Gallus sstewartgallus00@mylangara.bc.ca
[ruby-core:68172] [Bug #10866]
Actions
Like0
Like0Like0