diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2020-02-09 23:47:30 +0900 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-02-10 10:19:38 +0100 |
commit | 2de74af22be0ccf75f094caf48c8beb36a49d8c9 (patch) | |
tree | 5d06e4f1bc9a9d379c486c9766ac361049fb4087 | |
parent | 29431fcb5b14d4c5ac3b3161a076eb1a208349d9 (diff) | |
download | cygnal-2de74af22be0ccf75f094caf48c8beb36a49d8c9.tar.gz cygnal-2de74af22be0ccf75f094caf48c8beb36a49d8c9.tar.bz2 cygnal-2de74af22be0ccf75f094caf48c8beb36a49d8c9.zip |
Cygwin: pty: Fix state mismatch caused in mintty.
- 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.
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 16 | ||||
-rw-r--r-- | winsup/cygwin/fork.cc | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index f2fd680ea..260776a56 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -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; + } } } diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index a8f0fb82a..691d08137 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -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; |