* syscalls.cc (close_all_files): Use cygheap_fdget to manipulate fhandler. Use

debug_only_printf.
This commit is contained in:
Christopher Faylor 2012-02-02 16:58:13 +00:00
parent b2ec6677ed
commit ab1fb53505
2 changed files with 19 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2012-02-02 Christopher Faylor <me.cygwin2012@cgf.cx>
* syscalls.cc (close_all_files): Use cygheap_fdget to manipulate
fhandler. Use debug_only_printf.
2012-02-02 Corinna Vinschen <corinna@vinschen.de>
Fix memory and handle leaks due to fdopendir:

View File

@ -90,22 +90,22 @@ close_all_files (bool norelease)
semaphore::terminate ();
fhandler_base *fh;
HANDLE h = NULL;
for (int i = 0; i < (int) cygheap->fdtab.size; i++)
if ((fh = cygheap->fdtab[i]) != NULL)
{
#ifdef DEBUGGING
debug_printf ("closing fd %d", i);
#endif
cygheap_fdget cfd (i);
if (cfd >= 0)
{
debug_only_printf ("closing fd %d", i);
if (i == 2)
DuplicateHandle (GetCurrentProcess (), fh->get_output_handle (),
DuplicateHandle (GetCurrentProcess (), cfd->get_output_handle (),
GetCurrentProcess (), &h,
0, false, DUPLICATE_SAME_ACCESS);
fh->close_with_arch ();
cfd->close_with_arch ();
if (!norelease)
cygheap->fdtab.release (i);
cfd.release ();
}
}
if (!have_execed && cygheap->ctty)