This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin/cygwin-acl] Fix iterating over pending signals if a signal doesn't have to be cleared


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d735b30eefe2d35d0d2a2d66ac12004662fc1525

commit d735b30eefe2d35d0d2a2d66ac12004662fc1525
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Nov 5 10:09:08 2015 +0100

    Fix iterating over pending signals if a signal doesn't have to be cleared
    
    	* sigproc.cc (pending_signals::clear): Yet another fix to fix the fix.
    	Actually iterate over the list of pending signals even if there's a
    	signal which doesn't have to be cleared.  Other than that, revert loop
    	to it's former self as a while loop.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/ChangeLog  |  7 +++++++
 winsup/cygwin/sigproc.cc | 11 ++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 2946387..a3f7cac 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2015-11-05  Corinna Vinschen  <corinna@vinschen.de>
+
+	* sigproc.cc (pending_signals::clear): Yet another fix to fix the fix.
+	Actually iterate over the list of pending signals even if there's a
+	signal which doesn't have to be cleared.  Other than that, revert loop
+	to it's former self as a while loop.
+
 2015-11-04  Corinna Vinschen  <corinna@vinschen.de>
 
 	* globals.cc (ro_u_prlfs): Add trailing NUL.  Explain why.
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 6a7708f..9810045 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -402,11 +402,16 @@ sig_clear (int sig)
 void
 pending_signals::clear (_cygtls *tls)
 {
-  sigpacket *q, *qnext;
+  sigpacket *q = &start, *qnext;
 
-  for (q = &start; (qnext = q->next); q->next = qnext->next)
+  while ((qnext = q->next))
     if (qnext->sigtls == tls)
-      qnext->si.si_signo = 0;
+      {
+	qnext->si.si_signo = 0;
+	q->next = qnext->next;
+      }
+    else
+      q = qnext;
 }
 
 /* Clear pending signals of specific thread.  Called from _cygtls::remove */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]