bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] Use SA_ONSTACK even if SA_SIGINFO is unavailable.


From: Ingo Weinhold
Subject: [PATCH 2/4] Use SA_ONSTACK even if SA_SIGINFO is unavailable.
Date: Wed, 05 Nov 2008 04:15:43 +0100
User-agent: Beam 1.1.2

If SA_ONSTACK exists, use it even if SA_SIGINFO doesn't. This does at least
allow for a somewhat controlled program termination on stack overflow. E.g.
in Haiku this prevents the debug server dialog box from popping up.

Signed-off-by: Ingo Weinhold <address@hidden>
---
 lib/c-stack.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib/c-stack.c b/lib/c-stack.c
index 11cb9ef..3111c9a 100644
--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -317,7 +317,11 @@ c_stack_action (void (*action) (int))
   act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND | SA_SIGINFO;
   act.sa_sigaction = segv_handler;
 # else
-  act.sa_flags = SA_NODEFER | SA_RESETHAND;
+#   ifdef SA_ONSTACK
+      act.sa_flags = SA_NODEFER | SA_RESETHAND | SA_ONSTACK;
+#   else
+      act.sa_flags = SA_NODEFER | SA_RESETHAND;
+#   endif
   act.sa_handler = die;
 # endif
 
-- 
1.5.2.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]