public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: pty: Fix race condition in initialization of pseudo console.
@ 2020-10-26  9:05 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2020-10-26  9:05 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7b996f807e0be210acddfd5e34e171e98321de8b

commit 7b996f807e0be210acddfd5e34e171e98321de8b
Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>
Date:   Mon Oct 26 17:29:31 2020 +0900

    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.

Diff:
---
 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-26  9:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26  9:05 [newlib-cygwin] Cygwin: pty: Fix race condition in initialization of pseudo console 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).