* syscalls.cc (close_all_files): Simplify logic around closing ctty.

This commit is contained in:
Christopher Faylor 2003-12-27 02:41:07 +00:00
parent e35f197f34
commit fe861ce934
2 changed files with 10 additions and 9 deletions

View File

@ -1,3 +1,7 @@
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> 2003-12-26 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (_pinfo::set_ctty): *Always* call close on opened ctty since * pinfo.cc (_pinfo::set_ctty): *Always* call close on opened ctty since

View File

@ -89,15 +89,6 @@ close_all_files (void)
{ {
SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "close_all_files"); 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; fhandler_base *fh;
for (int i = 0; i < (int) cygheap->fdtab.size; i++) for (int i = 0; i < (int) cygheap->fdtab.size; i++)
if ((fh = cygheap->fdtab[i]) != NULL) if ((fh = cygheap->fdtab[i]) != NULL)
@ -109,6 +100,12 @@ close_all_files (void)
cygheap->fdtab.release (i); 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"); ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "close_all_files");
user_shared->delqueue.process_queue (); user_shared->delqueue.process_queue ();
} }