Currently, sigpacket::process() clears some signals from the queue.
For instance, SIGSTOP clears SIGCONT and SIGCONT clears SIGSTOP, etc.
These might be needed by previous queue design, however, new queue
design does not require that. On the contrary, that causes signal
lost. With this patch, these sig_clear() calls are removed.

Addresses: https://cygwin.com/pipermail/cygwin/2025-March/257582.html
Fixes: 1fd5e000ace5 ("import winsup-2000-02-17 snapshot")
Reported-by: Christian Franke <christian.fra...@t-online.de>
Reviewed-by: Corinna Vinschen <cori...@vinschen.de>
Signed-off-by: Takashi Yano <takashi.y...@nifty.ne.jp>
---
 winsup/cygwin/exceptions.cc | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index a05883e3f..73cfc7967 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1436,12 +1436,6 @@ _cygtls::handle_SIGCONT ()
 
   myself->stopsig = 0;
   InterlockedAnd ((LONG *) &myself->process_state, ~PID_STOPPED);
-
-  /* Clear pending stop signals */
-  sig_clear (SIGSTOP, false);
-  sig_clear (SIGTSTP, false);
-  sig_clear (SIGTTIN, false);
-  sig_clear (SIGTTOU, false);
 }
 
 int
@@ -1547,15 +1541,7 @@ sigpacket::process ()
   if (si.si_signo == SIGKILL)
     goto exit_sig;
   if (si.si_signo == SIGSTOP)
-    {
-      sig_clear (SIGCONT, false);
-      goto stop;
-    }
-
-  /* Clear pending SIGCONT on stop signals */
-  if (si.si_signo == SIGTSTP || si.si_signo == SIGTTIN
-      || si.si_signo == SIGTTOU)
-    sig_clear (SIGCONT, false);
+    goto stop;
 
   if (handler == (void *) SIG_DFL)
     {
-- 
2.45.1

Reply via email to