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.
This commit is contained in:
Nicholas J. Kain 2020-09-02 21:04:59 -04:00
parent fb143995d2
commit ba046c02c7
2 changed files with 2 additions and 2 deletions

View File

@ -166,7 +166,7 @@ static void setup_signals_ndhc(void)
sigaddset(&mask, SIGUSR2); sigaddset(&mask, SIGUSR2);
sigaddset(&mask, SIGCHLD); sigaddset(&mask, SIGCHLD);
sigaddset(&mask, SIGTERM); sigaddset(&mask, SIGTERM);
if (sigprocmask(SIG_BLOCK, &mask, (sigset_t *)0) < 0) if (sigprocmask(SIG_UNBLOCK, &mask, (sigset_t *)0) < 0)
suicide("sigprocmask failed"); suicide("sigprocmask failed");
if (cs.signalFd >= 0) { if (cs.signalFd >= 0) {
epoll_del(cs.epollFd, cs.signalFd); epoll_del(cs.epollFd, cs.signalFd);

View File

@ -77,7 +77,7 @@ int setup_signals_subprocess(void)
sigaddset(&mask, SIGHUP); sigaddset(&mask, SIGHUP);
sigaddset(&mask, SIGINT); sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGTERM); sigaddset(&mask, SIGTERM);
if (sigprocmask(SIG_BLOCK, &mask, (sigset_t *)0) < 0) if (sigprocmask(SIG_UNBLOCK, &mask, (sigset_t *)0) < 0)
suicide("sigprocmask failed"); suicide("sigprocmask failed");
int sfd = signalfd(-1, &mask, SFD_NONBLOCK); int sfd = signalfd(-1, &mask, SFD_NONBLOCK);
if (sfd < 0) if (sfd < 0)