[PATCH] Cygwin: console: Abort read() on SIGWINCH if SA_RESTART is not set.

Takashi Yano takashi.yano@nifty.ne.jp
Sun Feb 14 08:52:06 GMT 2021


- Currently, console read() keeps reading after SIGWINCH is sent
  even if SA_RESTART flag is not set. With this patch, read()
  returns EINTR on SIGWINCH if SA_RESTART flag is not set.
---
 winsup/cygwin/fhandler_console.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 3c0783575..bdd6e5bb6 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -591,7 +591,9 @@ wait_retry:
 	  continue;
 	case input_winch:
 	  release_input_mutex ();
-	  continue;
+	  if (global_sigs[SIGWINCH].sa_flags & SA_RESTART)
+	    continue;
+	  goto sig_exit;
 	default:
 	  /* Should not come here */
 	  release_input_mutex ();
-- 
2.30.0



More information about the Cygwin-patches mailing list