diff options
| author | bcook <> | 2014-07-09 14:26:59 +0000 |
|---|---|---|
| committer | bcook <> | 2014-07-09 14:26:59 +0000 |
| commit | 4dd79c01d19267f9e0e25c16ef93a63aeca9d177 (patch) | |
| tree | 273334b14df370127bfa1cfe3738a5bb458cef33 /src/regress/lib/libc | |
| parent | dfc4e30a52d4059245bd4a6dc8081b1d789ae58f (diff) | |
| download | openbsd-4dd79c01d19267f9e0e25c16ef93a63aeca9d177.tar.gz openbsd-4dd79c01d19267f9e0e25c16ef93a63aeca9d177.tar.bz2 openbsd-4dd79c01d19267f9e0e25c16ef93a63aeca9d177.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@
Diffstat (limited to 'src/regress/lib/libc')
| -rw-r--r-- | src/regress/lib/libc/explicit_bzero/explicit_bzero.c | 5 |
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 | ||
