diff options
author | Marco S Hyman <marc@cvs.openbsd.org> | 2003-01-27 08:48:42 +0000 |
---|---|---|
committer | Marco S Hyman <marc@cvs.openbsd.org> | 2003-01-27 08:48:42 +0000 |
commit | 198e947aa61d20f434447fca918b04327ea89f87 (patch) | |
tree | 5f2452b9af1b0e6b06cf7144f13dbdfca0b73941 /regress/lib/libpthread/sigsuspend | |
parent | 2719b25a92c4fa4608e3ee82add476a0aeae3034 (diff) |
Another incorrect regression test. POSIX specifies that signal
handlers will be called with the current signal masked unless the
handler was installed with the SA_NODEFER flag. The test did
not check this (and the pthread code was incorrect by not setting
the mask). This fixes the test. The pthread lib part of the fix
will be made in a short while. Untill then the test will fail.
Diffstat (limited to 'regress/lib/libpthread/sigsuspend')
-rw-r--r-- | regress/lib/libpthread/sigsuspend/sigsuspend.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/regress/lib/libpthread/sigsuspend/sigsuspend.c b/regress/lib/libpthread/sigsuspend/sigsuspend.c index 25f22730ae2..d8b521ba3c3 100644 --- a/regress/lib/libpthread/sigsuspend/sigsuspend.c +++ b/regress/lib/libpthread/sigsuspend/sigsuspend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.c,v 1.3 2002/10/21 18:58:57 marc Exp $ */ +/* $OpenBSD: sigsuspend.c,v 1.4 2003/01/27 08:48:41 marc Exp $ */ /* * Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com> * All rights reserved. @@ -96,6 +96,7 @@ sighandler (int signo) int save_errno = errno; char buf[8192]; sigset_t set; + sigset_t tmp; pthread_t self; if ((signo >= 0) && (signo <= NSIG)) @@ -103,7 +104,11 @@ sighandler (int signo) /* * If we are running on behalf of the suspender thread, - * ensure that we have the correct mask set. + * ensure that we have the correct mask set. NOTE: per + * POSIX the current signo will be part of the mask unless + * SA_NODEFER was specified. Since it isn't in this test + * add the current signal to the original suspender_mask + * before checking. */ self = pthread_self (); if (self == suspender_tid) { @@ -114,7 +119,9 @@ sighandler (int signo) "signal %d (%s)\n", signo, strsignal(signo)); write(STDOUT_FILENO, buf, strlen(buf)); sigprocmask (SIG_SETMASK, NULL, &set); - ASSERT(set == suspender_mask); + tmp = suspender_mask; + sigaddset(&tmp, signo); + ASSERT(set == tmp); } else { snprintf(buf, sizeof buf, " -> Main thread signal handler caught " |