summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_tty.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 47ba20720..0e451b482 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -605,8 +605,11 @@ fhandler_tty_slave::open (int flags, mode_t)
}
b = AllocConsole (); // will cause flashing if workstation
// stuff fails
- if (horig && h != horig)
- SetProcessWindowStation (horig);
+ if (horig && h && h != horig)
+ {
+ SetProcessWindowStation (horig);
+ CloseHandle (h);
+ }
termios_printf ("%d = AllocConsole (), %E", b);
if (b)
init_console_handler (TRUE);