about summary refs log tree commit diff
path: root/sysdeps/generic/segfault.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-12 21:33:22 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-12 21:33:22 +0000
commitb39c6f8b7a847270f8b0a0c9f101535cce29d00e (patch)
tree32774357959d3cd9b0f93708f9c2b7598c80885e /sysdeps/generic/segfault.c
parentc06cc21c043b02d0d7c078730695be370c66571c (diff)
downloadglibc-b39c6f8b7a847270f8b0a0c9f101535cce29d00e.tar.gz
glibc-b39c6f8b7a847270f8b0a0c9f101535cce29d00e.tar.xz
glibc-b39c6f8b7a847270f8b0a0c9f101535cce29d00e.zip
Update.
1998-09-12  Mark Kettenis  <kettenis@phys.uva.nl>

	* sysdeps/generic/segfault.c (install_handler): Install signal
	handler with SA_ONSTACK instead of setting the stack flags to
	SS_ONSTACK.  Do not install handler for SIGSTKFLT if it is not
	defined.

1998-09-12 14:24 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* signal/signal.h: Fix multiple inclusion guard to cover the
	entire file.
	* wcsmbs/wchar.h: Remove prototype of internal function
	__mbsrtowcs.
	* sysdeps/i386/i486/bits/string.h (memchr): Don't do
	arithmetic on `void *'.
Diffstat (limited to 'sysdeps/generic/segfault.c')
-rw-r--r--sysdeps/generic/segfault.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c
index 5a9e64a105..b0778df6fc 100644
--- a/sysdeps/generic/segfault.c
+++ b/sysdeps/generic/segfault.c
@@ -163,6 +163,23 @@ install_handler (void)
   sigemptyset (&sa.sa_mask);
   sa.sa_flags = SA_RESTART;
 
+  /* Maybe we are expected to use an alternative stack.  */
+  if (getenv ("SEGFAULT_USE_ALTSTACK") != 0)
+    {
+      void *stack_mem = malloc (2 * SIGSTKSZ);
+      struct sigaltstack ss;
+
+      if (stack_mem != NULL)
+	{
+	  ss.ss_sp = stack_mem;
+	  ss.ss_flags = 0;
+	  ss.ss_size = 2 * SIGSTKSZ;
+
+	  if (sigaltstack (&ss, NULL) == 0)
+	    sa.sa_flags |= SA_ONSTACK;
+	}
+    }
+  
   if (sigs == NULL)
     sigaction (SIGSEGV, &sa, NULL);
   else if (sigs[0] == '\0')
@@ -191,20 +208,4 @@ install_handler (void)
       INSTALL_FOR_SIG (SIGABRT, "abrt");
       INSTALL_FOR_SIG (SIGFPE, "fpe");
     }
-
-  /* Maybe we are expected to use an alternative stack.  */
-  if (getenv ("SEGFAULT_USE_ALTSTACK") != 0)
-    {
-      void *stack_mem = malloc (2 * SIGSTKSZ);
-      struct sigaltstack ss;
-
-      if (stack_mem != NULL)
-	{
-	  ss.ss_sp = stack_mem;
-	  ss.ss_flags = SS_ONSTACK;
-	  ss.ss_size = 2 * SIGSTKSZ;
-
-	  sigaltstack (&ss, NULL);
-	}
-    }
 }