diff options
Diffstat (limited to 'winsup/cygwin/tty.cc')
-rw-r--r-- | winsup/cygwin/tty.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index fd8132c3a..e374acb7c 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -282,16 +282,22 @@ tty_list::allocate_tty (bool with_console) out: if (freetty < 0) - system_printf ("No tty allocated"); + { + ReleaseMutex (tty_mutex); + system_printf ("No tty allocated"); + } else if (!with_console) - termios_printf ("tty%d allocated", freetty); + { + termios_printf ("tty%d allocated", freetty); + /* exit with tty_mutex still held -- caller has more work to do */ + } else { termios_printf ("console %p associated with tty%d", console, freetty); if (!hmaster) create_tty_master (freetty); + ReleaseMutex (tty_mutex); } - ReleaseMutex (tty_mutex); return freetty; } |