Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-08-09 19:04:32 +0400
committerChristopher Faylor <me@cgf.cx>2006-08-09 19:04:32 +0400
commitbbf38a55c6d1df220bd0160a99907048b6d215a0 (patch)
tree1c41c0a7d38123bfa2ff20fe7a337fc3e1e7dfab /winsup/cygwin/debug.cc
parent7636b58590621af3c341c3eb37a017e0e6598d3f (diff)
* 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.
Diffstat (limited to 'winsup/cygwin/debug.cc')
-rw-r--r--winsup/cygwin/debug.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
index 004ddec0f..5e92d40a1 100644
--- a/winsup/cygwin/debug.cc
+++ b/winsup/cygwin/debug.cc
@@ -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