On HP-UX, don't pretend it was a SIGSEGV when it was a stack overflow.
authorBruno Haible <bruno@clisp.org>
Sat, 24 Jan 2009 13:05:48 +0000 (14:05 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 24 Jan 2009 13:05:48 +0000 (14:05 +0100)
ChangeLog
lib/c-stack.c

index f8fc16f..1406909 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-01-24  Bruno Haible  <bruno@clisp.org>
 
+       * lib/c-stack.c (segv_handler): If !HAVE_XSI_STACK_OVERFLOW_HEURISTIC,
+       set signo = 0 also if info->si_code <= 0. Needed on HP-UX 11.11.
+       Reported by Gary V. Vaughan <gary@gnu.org>.
+
+2009-01-24  Bruno Haible  <bruno@clisp.org>
+
        * lib/c-strtod.h (c_strtod, c_strtold): Add specification.
 
 2009-01-23  Bruno Haible  <bruno@clisp.org>
index e5e3ab6..d260b47 100644 (file)
@@ -239,21 +239,21 @@ segv_handler (int signo, siginfo_t *info,
              void *context __attribute__ ((unused)))
 {
   /* Clear SIGNO if it seems to have been a stack overflow.  */
-  if (0 < info->si_code)
-    {
 #  if ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC
-      /* We can't easily determine whether it is a stack overflow; so
-        assume that the rest of our program is perfect (!) and that
-        this segmentation violation is a stack overflow.
-
-        Note that although both Linux and Solaris provide
-        sigaltstack, SA_ONSTACK, and SA_SIGINFO, currently only
-        Solaris satisfies the XSI heueristic.  This is because
-        Solaris populates uc_stack with the details of the
-        interrupted stack, while Linux populates it with the details
-        of the current stack.  */
-      signo = 0;
+  /* We can't easily determine whether it is a stack overflow; so
+     assume that the rest of our program is perfect (!) and that
+     this segmentation violation is a stack overflow.
+
+     Note that although both Linux and Solaris provide
+     sigaltstack, SA_ONSTACK, and SA_SIGINFO, currently only
+     Solaris satisfies the XSI heueristic.  This is because
+     Solaris populates uc_stack with the details of the
+     interrupted stack, while Linux populates it with the details
+     of the current stack.  */
+  signo = 0;
 #  else
+  if (0 < info->si_code)
+    {
       /* If the faulting address is within the stack, or within one
         page of the stack end, assume that it is a stack
         overflow.  */
@@ -278,8 +278,8 @@ segv_handler (int signo, siginfo_t *info,
        write (STDERR_FILENO, buf, strlen (buf));
       }
 #   endif
-#  endif
     }
+#  endif
 
   die (signo);
 }