aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/fhandler_tty.cc11
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;