sigchain: properly block signal when we forward.
The previous code incorrectly chose to unblock the received signal when
SA_NODEFER was passed, instead of blocking the signal when SA_NODEFER
was not passed.
Bug: http://b/38305752
Bug: http://b/62189102
Bug: http://b/62202711
Test: m test-art-host
Change-Id: I2a7176b2a9fc7cdd0193face46f6d14a617ca814
diff --git a/sigchainlib/sigchain.cc b/sigchainlib/sigchain.cc
index df4372f..b8ab51b 100644
--- a/sigchainlib/sigchain.cc
+++ b/sigchainlib/sigchain.cc
@@ -262,8 +262,8 @@
ucontext_t* ucontext = static_cast<ucontext_t*>(ucontext_raw);
sigset_t mask;
sigorset(&mask, &ucontext->uc_sigmask, &chains[signo].action_.sa_mask);
- if ((handler_flags & SA_NODEFER)) {
- sigdelset(&mask, signo);
+ if (!(handler_flags & SA_NODEFER)) {
+ sigaddset(&mask, signo);
}
linked_sigprocmask(SIG_SETMASK, &mask, nullptr);