diff options
author | bcook <bcook@cvs.openbsd.org> | 2014-07-09 14:27:00 +0000 |
---|---|---|
committer | bcook <bcook@cvs.openbsd.org> | 2014-07-09 14:27:00 +0000 |
commit | 0db66873874fdf3297cc211ba46de9dc6df6cbdb (patch) | |
tree | 5cb2f64f083258c9ddbdf6b8be41176eda5a5abf /regress/lib/libc | |
parent | ff7305007939dd05f8dc62b7f85e29c5655bb8f5 (diff) |
check if we were previously on a signal stack before restoring.
OS X fails to restore the old signal stack because the signal stack is
not enabled by default. This causes sigaltstack(2) to fail with ENOMEM
as ss_size is 0, < MINSIGSTCKSZ.
ok jsing@
Diffstat (limited to 'regress/lib/libc')
-rw-r--r-- | regress/lib/libc/explicit_bzero/explicit_bzero.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/regress/lib/libc/explicit_bzero/explicit_bzero.c b/regress/lib/libc/explicit_bzero/explicit_bzero.c index b4b6c9e559e..d78c4d60541 100644 --- a/regress/lib/libc/explicit_bzero/explicit_bzero.c +++ b/regress/lib/libc/explicit_bzero/explicit_bzero.c @@ -1,4 +1,4 @@ -/* $OpenBSD: explicit_bzero.c,v 1.1 2014/06/12 22:01:55 matthew Exp $ */ +/* $OpenBSD: explicit_bzero.c,v 1.2 2014/07/09 14:26:59 bcook Exp $ */ /* * Copyright (c) 2014 Google Inc. * @@ -67,7 +67,8 @@ call_on_stack(void (*fn)(int), void *stack, size_t stacklen) /* Restore the original signal action, stack, and mask. */ ASSERT_EQ(0, sigaction(SIGUSR1, &oldsigact, NULL)); - ASSERT_EQ(0, sigaltstack(&oldsigstk, NULL)); + if (oldsigstk.ss_flags & SA_ONSTACK) + ASSERT_EQ(0, sigaltstack(&oldsigstk, NULL)); ASSERT_EQ(0, sigprocmask(SIG_SETMASK, &oldsigset, NULL)); } |