* syscalls.cc (close_all_files): Use cygheap_fdget to manipulate fhandler. Use
debug_only_printf.
This commit is contained in:
parent
b2ec6677ed
commit
ab1fb53505
|
@ -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:
|
||||
|
|
|
@ -90,23 +90,23 @@ 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
|
||||
if (i == 2)
|
||||
DuplicateHandle (GetCurrentProcess (), fh->get_output_handle (),
|
||||
GetCurrentProcess (), &h,
|
||||
0, false, DUPLICATE_SAME_ACCESS);
|
||||
fh->close_with_arch ();
|
||||
if (!norelease)
|
||||
cygheap->fdtab.release (i);
|
||||
}
|
||||
{
|
||||
cygheap_fdget cfd (i);
|
||||
if (cfd >= 0)
|
||||
{
|
||||
debug_only_printf ("closing fd %d", i);
|
||||
if (i == 2)
|
||||
DuplicateHandle (GetCurrentProcess (), cfd->get_output_handle (),
|
||||
GetCurrentProcess (), &h,
|
||||
0, false, DUPLICATE_SAME_ACCESS);
|
||||
cfd->close_with_arch ();
|
||||
if (!norelease)
|
||||
cfd.release ();
|
||||
}
|
||||
}
|
||||
|
||||
if (!have_execed && cygheap->ctty)
|
||||
cygheap->close_ctty ();
|
||||
|
|
Loading…
Reference in New Issue