From 3cd94e0c0ae9fce0bc8554c39af34c104778ff42 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 25 May 2006 05:40:51 +0000 Subject: * debug.h (ModifyHandle): Define new macro. (modify_handle): Declare new function. * debug.cc (modify_handle): Define new function. * fhandler.h (fhandler_base::fork_fixup): Change return value from void to bool. * fhandler.cc (fhandler_base::fork_fixup): Return true if fork fixup has been done. * pipe.cc (fhandler_pipe::set_close_on_exec): Set inheritance of protected handle via ModifyHandle if DEBUGGING. (fhandler_pipe::fixup_after_fork): Protect guard handle if fork fixup has been done. --- winsup/cygwin/pipe.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/pipe.cc') diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index b6bd0cf0c..183bd18de 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -155,7 +155,10 @@ fhandler_pipe::set_close_on_exec (bool val) { fhandler_base::set_close_on_exec (val); if (guard) - set_no_inheritance (guard, val); + { + set_no_inheritance (guard, val); + ModifyHandle (guard, !val); + } if (writepipe_exists) set_no_inheritance (writepipe_exists, val); } @@ -250,8 +253,8 @@ void fhandler_pipe::fixup_after_fork (HANDLE parent) { fhandler_base::fixup_after_fork (parent); - if (guard) - fork_fixup (parent, guard, "guard"); + if (guard && fork_fixup (parent, guard, "guard")) + ProtectHandle (guard); if (writepipe_exists) fork_fixup (parent, writepipe_exists, "writepipe_exists"); fixup_in_child (); -- cgit v1.2.3