From fe861ce9344d7577a909fc2878b2e61483bf6107 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 27 Dec 2003 02:41:07 +0000 Subject: * syscalls.cc (close_all_files): Simplify logic around closing ctty. --- winsup/cygwin/syscalls.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'winsup/cygwin/syscalls.cc') diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 4a8cadefa..8bf74d5ae 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -89,15 +89,6 @@ close_all_files (void) { SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "close_all_files"); - if (cygheap->ctty) - { - if (cygheap->ctty->usecount == 1) - cygheap->ctty->close (); - else - cygheap->ctty->usecount--; - debug_printf ("ctty usecount %d", cygheap->ctty->archetype->usecount); - } - fhandler_base *fh; for (int i = 0; i < (int) cygheap->fdtab.size; i++) if ((fh = cygheap->fdtab[i]) != NULL) @@ -109,6 +100,12 @@ close_all_files (void) cygheap->fdtab.release (i); } + if (cygheap->ctty) + { + debug_printf ("closing ctty"); + cygheap->ctty->close (); + } + ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "close_all_files"); user_shared->delqueue.process_queue (); } -- cgit v1.2.3