From ba046c02c729c408d6a3d9efd01dbc930a0d4fc8 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Wed, 2 Sep 2020 21:04:59 -0400 Subject: [PATCH] Make custom SIGUSR signals work again. These were broken long ago when converting from signal() to sigprocmask(). This change also makes ctrl+c work again. --- src/ndhc.c | 2 +- src/sys.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ndhc.c b/src/ndhc.c index 3a4714b..2dc5894 100644 --- a/src/ndhc.c +++ b/src/ndhc.c @@ -166,7 +166,7 @@ static void setup_signals_ndhc(void) sigaddset(&mask, SIGUSR2); sigaddset(&mask, SIGCHLD); sigaddset(&mask, SIGTERM); - if (sigprocmask(SIG_BLOCK, &mask, (sigset_t *)0) < 0) + if (sigprocmask(SIG_UNBLOCK, &mask, (sigset_t *)0) < 0) suicide("sigprocmask failed"); if (cs.signalFd >= 0) { epoll_del(cs.epollFd, cs.signalFd); diff --git a/src/sys.c b/src/sys.c index 548e4d8..17b488a 100644 --- a/src/sys.c +++ b/src/sys.c @@ -77,7 +77,7 @@ int setup_signals_subprocess(void) sigaddset(&mask, SIGHUP); sigaddset(&mask, SIGINT); sigaddset(&mask, SIGTERM); - if (sigprocmask(SIG_BLOCK, &mask, (sigset_t *)0) < 0) + if (sigprocmask(SIG_UNBLOCK, &mask, (sigset_t *)0) < 0) suicide("sigprocmask failed"); int sfd = signalfd(-1, &mask, SFD_NONBLOCK); if (sfd < 0)