* [PATCH] Cygwin: pty: Fix race condition in initialization of pseudo console.
@ 2020-10-26 8:29 Takashi Yano
2020-10-26 9:05 ` Corinna Vinschen
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2020-10-26 8:29 UTC (permalink / raw)
To: cygwin-patches
- 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.
---
winsup/cygwin/fhandler_tty.cc | 9 ---------
1 file changed, 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;
--
2.29.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Cygwin: pty: Fix race condition in initialization of pseudo console.
2020-10-26 8:29 [PATCH] Cygwin: pty: Fix race condition in initialization of pseudo console Takashi Yano
@ 2020-10-26 9:05 ` Corinna Vinschen
0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2020-10-26 9:05 UTC (permalink / raw)
To: cygwin-patches
On Oct 26 17:29, Takashi Yano via Cygwin-patches wrote:
> - 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.
> ---
> winsup/cygwin/fhandler_tty.cc | 9 ---------
> 1 file changed, 9 deletions(-)
Pushed.
Thanks,
Corinna
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-26 9:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 8:29 [PATCH] Cygwin: pty: Fix race condition in initialization of pseudo console Takashi Yano
2020-10-26 9:05 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).