diff options
author | Christopher Faylor <me@cgf.cx> | 2003-12-27 02:41:07 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-12-27 02:41:07 +0000 |
commit | fe861ce9344d7577a909fc2878b2e61483bf6107 (patch) | |
tree | 0bb9b09c65e4035d4fa2f18077471b87ddbd009b | |
parent | e35f197f34bf50089e5590ae5f648b62089c108c (diff) | |
download | newlib-fe861ce9344d7577a909fc2878b2e61483bf6107.zip newlib-fe861ce9344d7577a909fc2878b2e61483bf6107.tar.gz newlib-fe861ce9344d7577a909fc2878b2e61483bf6107.tar.bz2 |
* syscalls.cc (close_all_files): Simplify logic around closing ctty.
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 15 |
2 files changed, 10 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6067f5e..3452248 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,9 @@ 2003-12-26 Christopher Faylor <cgf@redhat.com> + * syscalls.cc (close_all_files): Simplify logic around closing ctty. + +2003-12-26 Christopher Faylor <cgf@redhat.com> + * pinfo.cc (_pinfo::set_ctty): *Always* call close on opened ctty since it counts as an opened handle. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 4a8cade..8bf74d5 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 (); } |