diff options
author | deischen <deischen@FreeBSD.org> | 2000-10-25 11:46:07 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2000-10-25 11:46:07 +0000 |
commit | 727a941a161db6715518f117484b20847bc26cad (patch) | |
tree | 428e65909bc8fa35eed7f09de11d0e64c76ebdb8 /lib/libpthread/thread/thr_sigwait.c | |
parent | 6a37abd487cc8d6879d9219fdf5cd3e2f76a2f5d (diff) | |
download | FreeBSD-src-727a941a161db6715518f117484b20847bc26cad.zip FreeBSD-src-727a941a161db6715518f117484b20847bc26cad.tar.gz |
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]).
Diffstat (limited to 'lib/libpthread/thread/thr_sigwait.c')
-rw-r--r-- | lib/libpthread/thread/thr_sigwait.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |