about summary refs log tree commit diff
path: root/src/signal
diff options
context:
space:
mode:
Diffstat (limited to 'src/signal')
-rw-r--r--src/signal/sigset.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/signal/sigset.c b/src/signal/sigset.c
index 0d7b4564..f3e8c407 100644
--- a/src/signal/sigset.c
+++ b/src/signal/sigset.c
@@ -3,7 +3,7 @@
 void (*sigset(int sig, void (*handler)(int)))(int)
 {
 	struct sigaction sa, sa_old;
-	sigset_t mask;
+	sigset_t mask, mask_old;
 
 	sigemptyset(&mask);
 	if (sigaddset(&mask, sig) < 0)
@@ -12,7 +12,7 @@ void (*sigset(int sig, void (*handler)(int)))(int)
 	if (handler == SIG_HOLD) {
 		if (sigaction(sig, 0, &sa_old) < 0)
 			return SIG_ERR;
-		if (sigprocmask(SIG_BLOCK, &mask, &mask) < 0)
+		if (sigprocmask(SIG_BLOCK, &mask, &mask_old) < 0)
 			return SIG_ERR;
 	} else {
 		sa.sa_handler = handler;
@@ -20,8 +20,8 @@ void (*sigset(int sig, void (*handler)(int)))(int)
 		sigemptyset(&sa.sa_mask);
 		if (sigaction(sig, &sa, &sa_old) < 0)
 			return SIG_ERR;
-		if (sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0)
+		if (sigprocmask(SIG_UNBLOCK, &mask, &mask_old) < 0)
 			return SIG_ERR;
 	}
-	return sigismember(&mask, sig) ? SIG_HOLD : sa_old.sa_handler;
+	return sigismember(&mask_old, sig) ? SIG_HOLD : sa_old.sa_handler;
 }