diff options
author | Christopher Faylor <me@cgf.cx> | 2006-05-25 05:40:51 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-05-25 05:40:51 +0000 |
commit | 3cd94e0c0ae9fce0bc8554c39af34c104778ff42 (patch) | |
tree | c8e1a08c0d546133a04dc5411fdbc2a683e88c5b /winsup/cygwin/fhandler.cc | |
parent | 38229bcdcf45221857163f39d865d1d5d113a9b7 (diff) | |
download | cygnal-3cd94e0c0ae9fce0bc8554c39af34c104778ff42.tar.gz cygnal-3cd94e0c0ae9fce0bc8554c39af34c104778ff42.tar.bz2 cygnal-3cd94e0c0ae9fce0bc8554c39af34c104778ff42.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 66dffdc64..bd91551d6 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1464,17 +1464,23 @@ fhandler_base::set_no_inheritance (HANDLE &h, int not_inheriting) #endif } -void +bool fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name) { HANDLE oh = h; + bool res = false; if (/* !is_socket () && */ !close_on_exec ()) debug_printf ("handle %p already opened", h); else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, !close_on_exec (), DUPLICATE_SAME_ACCESS)) system_printf ("%s - %E, handle %s<%p>", get_name (), name, h); - else if (oh != h) - VerifyHandle (h); + else + { + if (oh != h) + VerifyHandle (h); + res = true; + } + return res; } void |