summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbcook <>2014-07-09 14:26:59 +0000
committerbcook <>2014-07-09 14:26:59 +0000
commitfc64ddc4b0d85b533bef98d8851464f470c2cb39 (patch)
tree273334b14df370127bfa1cfe3738a5bb458cef33
parent1f04aa3ea57f022c5b7ce1e2901ee07df82c12fa (diff)
downloadopenbsd-fc64ddc4b0d85b533bef98d8851464f470c2cb39.tar.gz
openbsd-fc64ddc4b0d85b533bef98d8851464f470c2cb39.tar.bz2
openbsd-fc64ddc4b0d85b533bef98d8851464f470c2cb39.zip
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@
-rw-r--r--src/regress/lib/libc/explicit_bzero/explicit_bzero.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c
index b4b6c9e559..d78c4d6054 100644
--- a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c
+++ b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: explicit_bzero.c,v 1.1 2014/06/12 22:01:55 matthew Exp $ */ 1/* $OpenBSD: explicit_bzero.c,v 1.2 2014/07/09 14:26:59 bcook Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Google Inc. 3 * Copyright (c) 2014 Google Inc.
4 * 4 *
@@ -67,7 +67,8 @@ call_on_stack(void (*fn)(int), void *stack, size_t stacklen)
67 67
68 /* Restore the original signal action, stack, and mask. */ 68 /* Restore the original signal action, stack, and mask. */
69 ASSERT_EQ(0, sigaction(SIGUSR1, &oldsigact, NULL)); 69 ASSERT_EQ(0, sigaction(SIGUSR1, &oldsigact, NULL));
70 ASSERT_EQ(0, sigaltstack(&oldsigstk, NULL)); 70 if (oldsigstk.ss_flags & SA_ONSTACK)
71 ASSERT_EQ(0, sigaltstack(&oldsigstk, NULL));
71 ASSERT_EQ(0, sigprocmask(SIG_SETMASK, &oldsigset, NULL)); 72 ASSERT_EQ(0, sigprocmask(SIG_SETMASK, &oldsigset, NULL));
72} 73}
73 74