From 0f3e6315712428fcbfc0b6ffeec7c850d9b7206a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 30 Jun 2015 20:43:50 +0200 Subject: [PATCH] Add comment to sigaltstack to explain setting ss_flags here * signal.cc (sigaltstack): Add comment. Signed-off-by: Corinna Vinschen --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/signal.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 31b429ba1..01bb3eb68 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2015-06-30 Corinna Vinschen + + * signal.cc (sigaltstack): Add comment. + 2015-06-27 Corinna Vinschen * exceptions.cc (_cygtls::call_signal_handler): Drop manipulating diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 467c919c3..2b9cfda3e 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -670,6 +670,10 @@ sigaltstack (const stack_t *ss, stack_t *oss) { char stack_marker; memcpy (oss, &me.altstack, sizeof *oss); + /* Check if the current stack is the alternate signal stack. If so, + set ss_flags accordingly. We do this here rather than setting + ss_flags in _cygtls::call_signal_handler since the signal handler + calls longjmp, so we never return to reset the flag. */ if (!me.altstack.ss_flags && me.altstack.ss_sp) { if (&stack_marker >= (char *) me.altstack.ss_sp