Literally blocking *all* signals is a bit too much

Programming errors like SIGSEGV and SIGBUS need to get through no
matter what and blocking them is undefined behavior anyway.
The odd man out in this list is SIGTSTP which is just otherwise useful
and not harmful since the process can be continued afterwards.
This commit is contained in:
Panu Matilainen 2016-12-15 15:15:33 +02:00
parent 120229d73a
commit bbdf819392
2 changed files with 7 additions and 1 deletions

View File

@ -173,6 +173,12 @@ int rpmsqBlock(int op)
blocked++;
if (blocked == 1) {
sigfillset(&newMask);
sigdelset(&newMask, SIGABRT);
sigdelset(&newMask, SIGBUS);
sigdelset(&newMask, SIGFPE);
sigdelset(&newMask, SIGILL);
sigdelset(&newMask, SIGSEGV);
sigdelset(&newMask, SIGTSTP);
ret = pthread_sigmask(SIG_BLOCK, &newMask, &oldMask);
}
} else if (op == SIG_UNBLOCK) {

View File

@ -45,7 +45,7 @@ int rpmsqActivate(int state);
rpmsqAction_t rpmsqSetAction(int signum, rpmsqAction_t handler);
/** \ingroup rpmsq
* Block or unblock (all) signals.
* Block or unblock (almost) all signals.
* The operation is "reference counted" so the calls can be nested,
* and signals are only unblocked when the reference count falls to zero.
* @param op SIG_BLOCK/SIG_UNBLOCK