aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-12-22 20:25:22 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-12-22 20:38:08 +0900
commitf6e4e98d3071c8e41f50773ec3c7683fb104b3ab (patch)
tree611c0585038145fab2a853c55d0886f17bd559ad
parent0a7bf8fc4c061d550bae6668a6e2cd03c67dce46 (diff)
downloadnewlib-f6e4e98d3071c8e41f50773ec3c7683fb104b3ab.zip
newlib-f6e4e98d3071c8e41f50773ec3c7683fb104b3ab.tar.gz
newlib-f6e4e98d3071c8e41f50773ec3c7683fb104b3ab.tar.bz2
Cygwin: console: Fix hangup of less on quit after the window is resized.
https://cygwin.com/pipermail/cygwin/2022-December/252737.html If the less is started from non-cygwin shell and window size is changed, it will hang-up when quitting. The cause of the proglem is that less uses longjump() in signal handler. If the signal handler is called while cygwin is acquiring the mutex, cygwin loses the chance to release mutex. With this patch, the mutex is released just before calling kill_pgrp() and re-acquired when kill_pgrp() returns. Reported-by: Gregory Mason <grmason@epic.com> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
-rw-r--r--winsup/cygwin/fhandler/console.cc4
-rw-r--r--winsup/cygwin/release/3.4.44
2 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index bbf4b01..ee07c84 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -928,7 +928,11 @@ fhandler_console::send_winch_maybe ()
if (wincap.has_con_24bit_colors () && !con_is_legacy
&& wincap.has_con_broken_tabs ())
fix_tab_position (get_output_handle ());
+ /* longjmp() may be called in the signal handler like less,
+ so release input_mutex temporarily before kill_pgrp(). */
+ release_input_mutex ();
get_ttyp ()->kill_pgrp (SIGWINCH);
+ acquire_input_mutex (mutex_timeout);
return true;
}
return false;
diff --git a/winsup/cygwin/release/3.4.4 b/winsup/cygwin/release/3.4.4
index 6ac7023..3331b31 100644
--- a/winsup/cygwin/release/3.4.4
+++ b/winsup/cygwin/release/3.4.4
@@ -3,3 +3,7 @@ Bug Fixes
- Fix an uninitialized variable having weird side-effects in path handling.
Addresses: https://cygwin.com/pipermail/cygwin/2022-December/252734.html
+
+- Fix hang-up of less on quit which occurs when it is started from non-cygwin
+ shell and window is resized.
+ Addresses: https://cygwin.com/pipermail/cygwin/2022-December/252737.html