diff options
author | Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> | 2020-03-13 12:06:49 +0900 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-03-13 10:55:41 +0100 |
commit | 071b8e0cbd4be33449c12bb0d58f514ed8ef893c (patch) | |
tree | 3fd3a209309c6a820bd77559f69e2386fa51f176 | |
parent | 57a80207ff5f7045a45668cee827ce7f6906ccc8 (diff) | |
download | newlib-071b8e0cbd4be33449c12bb0d58f514ed8ef893c.zip newlib-071b8e0cbd4be33449c12bb0d58f514ed8ef893c.tar.gz newlib-071b8e0cbd4be33449c12bb0d58f514ed8ef893c.tar.bz2 |
Cygwin: pty: Add FreeConsole to destructor of pty slave.
- When pseudo console is closed, all the processes attched to the
pseudo console are terminated. This causes the problem reported
in https://sourceware.org/pipermail/cygwin/2020-March/244046.html.
This patch fixes the issue.
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index b42e0ae..b2e725d 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -706,8 +706,15 @@ fhandler_pty_slave::fhandler_pty_slave (int unit) fhandler_pty_slave::~fhandler_pty_slave () { if (!get_ttyp ()) - /* Why comes here? Who clears _tc? */ - return; + { + /* Why comes here? Who clears _tc? */ + if (freeconsole_on_close) + { + FreeConsole (); + pcon_attached_to = -1; + } + return; + } if (get_pseudo_console ()) { int used = 0; |