]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Fix state mismatch caused in mintty.
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Sun, 9 Feb 2020 14:47:30 +0000 (23:47 +0900)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 10 Feb 2020 09:19:38 +0000 (10:19 +0100)
- PTY has a bug reported in:
  https://cygwin.com/ml/cygwin/2020-02/msg00067.html.
  This is the result of state mismatch between real pseudo console
  attaching state and state variable. This patch fixes the issue.

winsup/cygwin/fhandler_tty.cc
winsup/cygwin/fork.cc

index f2fd680ea7eff019552b1c101f1c5dbd5a8ea81c..260776a5621d1955c79a67c1db3abbcf046e011d 100644 (file)
@@ -65,6 +65,12 @@ static bool isHybrid;
 static bool do_not_reset_switch_to_pcon;
 static bool freeconsole_on_close = true;
 
+void
+clear_pcon_attached_to (void)
+{
+  pcon_attached_to = -1;
+}
+
 static void
 set_switch_to_pcon (void)
 {
@@ -727,7 +733,10 @@ fhandler_pty_slave::~fhandler_pty_slave ()
        {
          init_console_handler (false);
          if (freeconsole_on_close)
-           FreeConsole ();
+           {
+             FreeConsole ();
+             pcon_attached_to = -1;
+           }
        }
     }
 }
@@ -2988,7 +2997,10 @@ fhandler_pty_slave::fixup_after_exec ()
        {
          init_console_handler (false);
          if (freeconsole_on_close)
-           FreeConsole ();
+           {
+             FreeConsole ();
+             pcon_attached_to = -1;
+           }
        }
     }
 
index a8f0fb82a42593b1b3b6a5e2dbc53515c7ac76c8..691d08137f1e3109dd0f7e32ca06cc19cf7ef7ed 100644 (file)
@@ -161,6 +161,8 @@ frok::child (volatile char * volatile here)
              }
          }
       }
+  extern void clear_pcon_attached_to (void); /* fhandler_tty.cc */
+  clear_pcon_attached_to ();
 
   HANDLE& hParent = ch.parent;
 
This page took 0.034837 seconds and 5 git commands to generate.