diff options
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 559819fee..5b7e69ba5 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -580,7 +580,8 @@ fhandler_tty_slave::open (int flags, mode_t) && wincap.pty_needs_alloc_console ()) { BOOL b; - if (!GetProcessWindowStation ()) + HWINSTA horig = GetProcessWindowStation (); + if (myself->ctty == -1) { HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih); termios_printf ("CreateWindowStation %p, %E", h); @@ -589,6 +590,8 @@ fhandler_tty_slave::open (int flags, mode_t) b = SetProcessWindowStation (h); termios_printf ("SetProcessWindowStation %d, %E", b); } + if (horig) + CloseWindowStation (horig); } b = AllocConsole (); // will cause flashing if workstation // stuff fails |