summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--signal.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 44bc26cd..2d87676a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-12-13 Kaz Kylheku <kaz@kylheku.com>
+ * signal.c (set_sig_handler): Disable signals around this
+ function because it manipulates the mask of deferred
+ signals which can also be manipulated by an async signal.
+
+2013-12-13 Kaz Kylheku <kaz@kylheku.com>
+
* signal.c (set_sig_handler): Clear the deferred flag
for a signal that is being set to ignored or default.
diff --git a/signal.c b/signal.c
index c833131b..4a089caf 100644
--- a/signal.c
+++ b/signal.c
@@ -130,6 +130,10 @@ val set_sig_handler(val signo, val lambda)
{
cnum sig = c_num(signo);
val old_lambda;
+ sigset_t block, saved;
+
+ sigfillset(&block);
+ sigprocmask(SIG_BLOCK, &block, &saved);
if (sig < 0 || sig >= MAX_SIG)
uw_throwf(error_s, lit("set-sig-handler: signal ~s out of range\n"), sig, nao);
@@ -159,6 +163,8 @@ val set_sig_handler(val signo, val lambda)
sig_lambda[sig] = lambda;
}
+ sigprocmask(SIG_SETMASK, &saved, 0);
+
return old_lambda;
}