From fc64ddc4b0d85b533bef98d8851464f470c2cb39 Mon Sep 17 00:00:00 2001 From: bcook <> Date: Wed, 9 Jul 2014 14:26:59 +0000 Subject: 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@ --- src/regress/lib/libc/explicit_bzero/explicit_bzero.c | 5 +++-- 1 file 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 @@ -/* $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)); } -- cgit v1.2.3-55-g6feb