diff options
author | Eric Blake <ebb9@byu.net> | 2008-08-25 06:26:56 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2008-08-25 06:26:56 -0600 |
commit | e3ea810706b94a625eadc27dda079d74cdd68440 (patch) | |
tree | c4caef8a31ac62a487c11d6be6dc74f43af701b3 /lib/c-stack.c | |
parent | 4c7d2071f79f8f753a2472c08ba8e7e1bb1ca455 (diff) | |
download | gnulib-e3ea810706b94a625eadc27dda079d74cdd68440.tar.gz |
c-stack: test that stack overflow can be caught
* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Also check
that platform allows handling stack overflow; at least OS/2 EMX
has sigaltstack, but crashes before transferring control to
handler on stack overflow.
* lib/c-stack.c [HAVE_SIGALTSTACK]: Adjust conditions to also
check for HAVE_STACK_OVERFLOW_HANDLING.
Reported by Elbert Pol.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/c-stack.c')
-rw-r--r-- | lib/c-stack.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/c-stack.c b/lib/c-stack.c index c46c231361..6802665f59 100644 --- a/lib/c-stack.c +++ b/lib/c-stack.c @@ -117,7 +117,8 @@ die (int signo) abort (); } -#if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK) || HAVE_LIBSIGSEGV +#if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \ + && HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV /* Storage for the alternate signal stack. */ static union @@ -210,7 +211,7 @@ c_stack_action (void (*action) (int)) return 0; } -#elif HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK +#elif HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK && HAVE_STACK_OVERFLOW_HANDLING /* Direction of the C runtime stack. This function is async-signal-safe. */ @@ -316,7 +317,8 @@ c_stack_action (void (*action) (int)) return sigaction (SIGSEGV, &act, NULL); } -#else /* ! ((HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK) || HAVE_LIBSIGSEGV) */ +#else /* ! ((HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK + && HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV) */ int c_stack_action (void (*action) (int) __attribute__ ((unused))) |