* 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:
@ -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
|
||||
|
Reference in New Issue
Block a user