From 727a941a161db6715518f117484b20847bc26cad Mon Sep 17 00:00:00 2001 From: deischen Date: Wed, 25 Oct 2000 11:46:07 +0000 Subject: Make pthread_kill() know about temporary signal handlers installed by sigwait(). This prevents a signal from being sent to the process when there are no application installed signal handlers. Correct a typo in sigwait (foo -> foo[i]). --- lib/libpthread/thread/thr_sigwait.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/libpthread/thread/thr_sigwait.c') diff --git a/lib/libpthread/thread/thr_sigwait.c b/lib/libpthread/thread/thr_sigwait.c index 6ba6855..f2c6ea1 100644 --- a/lib/libpthread/thread/thr_sigwait.c +++ b/lib/libpthread/thread/thr_sigwait.c @@ -108,10 +108,12 @@ sigwait(const sigset_t *set, int *sig) * mask because a subsequent sigaction could enable an * ignored signal. */ + sigemptyset(&tempset); for (i = 1; i < NSIG; i++) { if (sigismember(&waitset, i) && (_thread_sigact[i - 1].sa_handler == SIG_DFL)) { _thread_dfl_count[i]++; + sigaddset(&tempset, i); if (_thread_dfl_count[i] == 1) { if (_thread_sys_sigaction(i,&act,NULL) != 0) ret = -1; @@ -151,10 +153,10 @@ sigwait(const sigset_t *set, int *sig) /* Restore the sigactions: */ act.sa_handler = SIG_DFL; for (i = 1; i < NSIG; i++) { - if (sigismember(&waitset, i) && - (_thread_sigact[i - 1].sa_handler == SIG_DFL)) { + if (sigismember(&tempset, i)) { _thread_dfl_count[i]--; - if (_thread_dfl_count == 0) { + if ((_thread_sigact[i - 1].sa_handler == SIG_DFL) && + (_thread_dfl_count[i] == 0)) { if (_thread_sys_sigaction(i,&act,NULL) != 0) ret = -1; } -- cgit v1.1