diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2008-04-24 03:31:34 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2008-04-24 03:31:34 +0000 |
commit | 6b2473c027f24edba1bdd64ff89b13bec40a3365 (patch) | |
tree | 37e5df3188b3e5bb43236a379e95e6aa30172947 /regress | |
parent | e75ab05ae705cdd8919929a6c26af36867ca408a (diff) |
Return the proper values upon failure per POSIX for pthread_sigmask(3) and
sigprocmask(2) in threaded programs.
From Philip Guenther <guenther at sendmail.com> via PR library/5795.
okay marc@
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libpthread/sigmask/sigmask.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/regress/lib/libpthread/sigmask/sigmask.c b/regress/lib/libpthread/sigmask/sigmask.c index b3ccc0fa2a4..ccdf5fc5dc3 100644 --- a/regress/lib/libpthread/sigmask/sigmask.c +++ b/regress/lib/libpthread/sigmask/sigmask.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sigmask.c,v 1.2 2003/07/14 22:01:42 marc Exp $ */ +/* $OpenBSD: sigmask.c,v 1.3 2008/04/24 03:31:33 kurt Exp $ */ /* PUBLIC DOMAIN July 2003 Marco S Hyman <marc@snafu.org> */ #include <sys/time.h> @@ -29,7 +29,10 @@ int main (int argc, char *argv[]) /* mask sigalrm */ CHECKe(sigemptyset(&mask)); CHECKe(sigaddset(&mask, SIGALRM)); - CHECKe(pthread_sigmask(SIG_BLOCK, &mask, NULL)); + CHECKr(pthread_sigmask(SIG_BLOCK, &mask, NULL)); + + /* make sure pthread_sigmask() returns the right value on failure */ + CHECKe(pthread_sigmask(-1, &mask, NULL)); /* now trigger sigalrm and wait for it */ printf("trigger sigalrm[2] [masked, test should not die]\n"); @@ -38,7 +41,7 @@ int main (int argc, char *argv[]) /* sigwait for sigalrm, it should be pending. If it is not the test will hang. */ - CHECKe(sigwait(&mask, &sig)); + CHECKr(sigwait(&mask, &sig)); ASSERT(sig == SIGALRM); /* make sure sigwait didn't muck with the mask by triggering @@ -52,7 +55,7 @@ int main (int argc, char *argv[]) is triggered. */ if (argc > 1) { printf("trigger sigalrm[4] [unmasked, test should die]\n"); - CHECKe(pthread_sigmask(SIG_UNBLOCK, &mask, NULL)); + CHECKr(pthread_sigmask(SIG_UNBLOCK, &mask, NULL)); ualarm(100000, 0); CHECKe(sleep(1)); } |