summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>2020-10-26 17:29:31 +0900
committerCorinna Vinschen <corinna@vinschen.de>2020-10-26 10:04:12 +0100
commit7b996f807e0be210acddfd5e34e171e98321de8b (patch)
tree85ed20f04466d466c4701f968466bbdadbaa5aea
parent3752ab804bda1cbb38b5da91db8cf14f8bdefa2f (diff)
downloadcygnal-7b996f807e0be210acddfd5e34e171e98321de8b.tar.gz
cygnal-7b996f807e0be210acddfd5e34e171e98321de8b.tar.bz2
cygnal-7b996f807e0be210acddfd5e34e171e98321de8b.zip
Cygwin: pty: Fix race condition in initialization of pseudo console.
- If output of non-cygwin process is piped to cygwin process, such as less, the non-cygwin process sometimes fails to start and hangs. This patch fixes the issue.
-rw-r--r--winsup/cygwin/fhandler_tty.cc9
1 files changed, 0 insertions, 9 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 8910af1e7..c5a081ebd 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -784,8 +784,6 @@ fhandler_pty_slave::reset_switch_to_pcon (void)
return;
get_ttyp ()->pcon_pid = 0;
get_ttyp ()->switch_to_pcon_in = false;
- get_ttyp ()->h_pseudo_console = NULL;
- get_ttyp ()->pcon_start = false;
}
ssize_t __stdcall
@@ -2620,7 +2618,6 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env)
char *p;
int len;
int x1, y1, x2, y2;
- tcflag_t c_lflag;
DWORD t0;
/* Check if terminal has ANSI escape sequence. */
@@ -2629,8 +2626,6 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env)
/* Check if terminal has CSI6n */
WaitForSingleObject (input_mutex, INFINITE);
- c_lflag = get_ttyp ()->ti.c_lflag;
- get_ttyp ()->ti.c_lflag &= ~ICANON;
/* Set h_pseudo_console and pcon_start so that the response
will sent to io_handle rather than io_handle_cyg. */
get_ttyp ()->h_pseudo_console = (HPCON *) -1; /* dummy */
@@ -2687,10 +2682,7 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env)
break;
}
while (len);
- WaitForSingleObject (input_mutex, INFINITE);
get_ttyp ()->h_pseudo_console = NULL;
- get_ttyp ()->ti.c_lflag = c_lflag;
- ReleaseMutex (input_mutex);
if (len == 0)
return true;
@@ -2711,7 +2703,6 @@ not_has_csi6n:
in master write(). Therefore, clear it here manually. */
get_ttyp ()->pcon_start = false;
get_ttyp ()->h_pseudo_console = NULL;
- get_ttyp ()->ti.c_lflag = c_lflag;
ReleaseMutex (input_mutex);
maybe_dumb:
get_ttyp ()->pcon_cap_checked = true;