summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/signal.c b/signal.c
index cb2fcb3557..91aa7c418e 100644
--- a/signal.c
+++ b/signal.c
@@ -15,6 +15,7 @@
#include "vm_core.h"
#include <signal.h>
#include <stdio.h>
+#include <errno.h>
#ifdef _WIN32
typedef LONG rb_atomic_t;
@@ -474,8 +475,11 @@ ruby_signal(int signum, sighandler_t handler)
if (signum == SIGSEGV)
sigact.sa_flags |= SA_ONSTACK;
#endif
- if (sigaction(signum, &sigact, &old) < 0)
- rb_bug("sigaction error.\n");
+ if (sigaction(signum, &sigact, &old) < 0) {
+ if (errno != 0 && errno != EINVAL) {
+ rb_bug("sigaction error.\n");
+ }
+ }
return old.sa_handler;
}