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>2002-07-14 23:15:32 +0400
committerChristopher Faylor <me@cgf.cx>2002-07-14 23:15:32 +0400
commit3d0ba393dfa79cb4a43a3a753ad64f5caaae37cb (patch)
tree8f021e010562810ef3906ea7ec554fe7f2d3543f /winsup/cygwin/fhandler.cc
parentf5c3d180804531dabb521513b8d9da9a6b313f06 (diff)
* dcrt0.cc (dll_crt0_1): Move debug_init call back to here. Avoid a compiler
warning. * shared.cc (memory_init): Remove debug_init call. * debug.h (handle_list): Change "clexec" to "inherited". * debug.cc: Remove a spurious declaration. (setclexec): Conditionalize away since it is currently unused. (add_handle): Use inherited field rather than clexec. (debug_fixup_after_fork_exec): Ditto. Move debugging output to delete_handle. (delete_handle): Add debugging output. * fhandler.cc (fhandler_base::set_inheritance): Don't bother setting inheritance in debugging table since the handle was never protected anyway. (fhandler_base::fork_fixup): Ditto. * exceptions.cc (debugger_command): Revert.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index e0f065b14..591bc72f5 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1067,7 +1067,7 @@ fhandler_dev_null::dump (void)
void
fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
{
-#ifdef DEBUGGING
+#ifdef DEBUGGING_AND_FDS_PROTECTED
HANDLE oh = h;
#endif
/* Note that we could use SetHandleInformation here but it is not available
@@ -1078,7 +1078,7 @@ fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
if (!DuplicateHandle (hMainProc, h, hMainProc, &h, 0, !not_inheriting,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
debug_printf ("DuplicateHandle failed, %E");
-#ifdef DEBUGGING
+#ifdef DEBUGGING_AND_FDS_PROTECTED
if (h)
setclexec (oh, h, not_inheriting);
#endif
@@ -1087,21 +1087,16 @@ fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
void
fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
{
-#ifdef DEBUGGING
- HANDLE oh = h;
-#endif
if (/* !is_socket () && */ !get_close_on_exec ())
debug_printf ("handle %p already opened", h);
else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, !get_close_on_exec (),
DUPLICATE_SAME_ACCESS))
system_printf ("%s - %E, handle %s<%p>", get_name (), name, h);
-#ifdef DEBUGGING
+#ifdef DEBUGGING_AND_FDS_PROTECTED
+ else if (get_close_on_exec ())
+ ProtectHandle (h); /* would have to be fancier than this */
else
- {
- debug_printf ("%s success - oldh %p, h %p", get_name (), oh, h);
- // someday, maybe ProtectHandle2 (h, name);
- setclexec (oh, h, !get_close_on_exec ());
- }
+ /* ProtectHandleINH (h) */; /* Should already be protected */
#endif
}