From 65ebf94e53514dc266c74bea7908ad3fe7fc4ebc Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 28 Nov 2008 02:56:09 +0000 Subject: * exceptions.cc (sigpacket::process): Make sure that 'tls' is never NULL when used. --- winsup/cygwin/exceptions.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/exceptions.cc') diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index e744e7c5d..35aea1591 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1191,20 +1191,22 @@ sigpacket::process () else handler = NULL; + bool tls_was_null = !tls; + if (tls_was_null) + tls = _main_tls; + if (si.si_signo == SIGKILL) goto exit_sig; if (si.si_signo == SIGSTOP) { sig_clear (SIGCONT); - if (!tls) - tls = _main_tls; goto stop; } bool insigwait_mask; if ((masked = ISSTATE (myself, PID_STOPPED))) insigwait_mask = false; - else if (!tls) + else if (tls_was_null) insigwait_mask = !handler && (tls = _cygtls::find_tls (si.si_signo)); else insigwait_mask = sigismember (&tls->sigwait_mask, si.si_signo); @@ -1216,12 +1218,9 @@ sigpacket::process () /* nothing to do */; else if (sigismember (mask, si.si_signo)) masked = true; - else if (tls) + else masked = sigismember (&tls->sigmask, si.si_signo); - if (!tls) - tls = _main_tls; - if (masked) { sigproc_printf ("signal %d blocked", si.si_signo); -- cgit v1.2.3