* autoload.cc (GetHandleInformation): Declare new function.

(SetHandleInformation): Ditto.
* debug.cc (add_handle): Use SetHandleInformation to protect handle.
(close_handle): Use SetHandleInformation to unprotect handle.
* spawn.cc (spawn_guts): Move detached test outside of P_OVERLAY block.
This commit is contained in:
Christopher Faylor
2006-08-09 15:04:32 +00:00
parent 7636b58590
commit bbf38a55c6
4 changed files with 16 additions and 3 deletions

View File

@ -166,6 +166,7 @@ add_handle (const char *func, int ln, HANDLE h, const char *name, bool inh)
hl->pid = GetCurrentProcessId ();
cygheap->debug.endh->next = hl;
cygheap->debug.endh = hl;
SetHandleInformation (h, HANDLE_FLAG_PROTECT_FROM_CLOSE, HANDLE_FLAG_PROTECT_FROM_CLOSE);
debug_printf ("protecting handle '%s'(%p), inherited flag %d", hl->name, hl->h, hl->inherited);
}
@ -234,9 +235,10 @@ close_handle (const char *func, int ln, HANDLE h, const char *name, bool force)
if (!mark_closed (func, ln, h, name, force))
return false;
SetHandleInformation (h, HANDLE_FLAG_PROTECT_FROM_CLOSE, 0);
ret = CloseHandle (h);
#if 0 /* Uncomment to see CloseHandle failures */
#if 1 /* Uncomment to see CloseHandle failures */
if (!ret)
small_printf ("CloseHandle(%s) failed %s:%d\n", name, func, ln);
#endif