summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authorToby Goodwin <toby@paccrat.org>2014-09-02 08:01:39 +0100
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:22:10 +0100
commita8699a58d8632f21e897ea5c4900a15483a9a8ca (patch)
treefd8e7910807eb91bcd79d498582959f1d750f9c6 /signal.c
parentd884971193ef4934424b77ae862e8b0ecf70bab3 (diff)
release: rc-1.7.2
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/signal.c b/signal.c
index b5cbe63..037be1d 100644
--- a/signal.c
+++ b/signal.c
@@ -9,7 +9,7 @@
#include "jbwrap.h"
#if HAVE_SIGACTION
-static void (*sys_signal(int signum, void (*handler)(int)))(int) {
+void (*sys_signal(int signum, void (*handler)(int)))(int) {
struct sigaction new, old;
new.sa_handler = handler;
@@ -19,7 +19,9 @@ static void (*sys_signal(int signum, void (*handler)(int)))(int) {
return old.sa_handler;
}
#else
-#define sys_signal(sig, func) (signal((sig), (func)))
+void (*sys_signal(int signum, void (*handler)(int)))(int) {
+ return signal(signum, handler);
+}
#endif
void (*sighandlers[NUMOFSIGNALS])(int);
@@ -33,11 +35,6 @@ extern void catcher(int s) {
}
sys_signal(s, catcher);
-#if READLINE
- if (rl_active)
- siglongjmp(rl_buf.j, s);
-#endif /* READLINE */
-
#if HAVE_RESTARTABLE_SYSCALLS
if (slow) {
siglongjmp(slowbuf.j, s);
@@ -73,13 +70,11 @@ extern void (*rc_signal(int s, void (*h)(int)))(int) {
void (*old)(int);
sigchk();
old = sighandlers[s];
- if (h == SIG_DFL || h == SIG_IGN) {
- sighandlers[s] = h;
+ sighandlers[s] = h;
+ if (h == SIG_DFL || h == SIG_IGN)
sys_signal(s, h);
- } else {
- sighandlers[s] = h;
+ else
sys_signal(s, catcher);
- }
return old;
}