* hookapi.cc (find_first_notloaded_dll): New function.

* pinfo.cc (status_exit): New function.  Issue message when dll not found.  Use
find_first_notloaded_dll to find a nonexistent dll.
(pinfo::maybe_set_exit_code_from_windows): Call status_exit when exit code >=
0xc0000000UL.
* sigproc.cc (child_info::proc_retry): Return exit code when
STATUS_DLL_NOT_FOUND.
* spawn.cc (spawn_guts): Minor cleanup.
* syscalls.cc (close_all_files): Don't actually close stderr filehandle.  Just
make it noninheritable.
* winsup.h (find_first_notloaded_dll): Declare new function.
* ntdll.h: Add several missing NTSTATUS defines.
This commit is contained in:
Christopher Faylor
2008-03-27 01:50:40 +00:00
parent 73de02f44b
commit 93d606f60a
11 changed files with 143 additions and 16 deletions

View File

@@ -109,12 +109,17 @@ 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 ();
if (!norelease)
cygheap->fdtab.release (i);
@@ -123,6 +128,8 @@ close_all_files (bool norelease)
if (!hExeced && cygheap->ctty)
cygheap->close_ctty ();
if (h)
SetStdHandle (STD_ERROR_HANDLE, h);
cygheap->fdtab.unlock ();
}