diff lib/c-stack.c @ 10358:37fd490ee38d

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>
author Eric Blake <ebb9@byu.net>
date Mon, 25 Aug 2008 06:26:56 -0600
parents 9c24129c10e2
children 9867f4fee019
line wrap: on
line diff
--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -117,7 +117,8 @@
   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 @@
   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 @@
   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)))