diff options
author | Christopher Faylor <me@cgf.cx> | 2006-12-11 18:55:29 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-12-11 18:55:29 +0000 |
commit | c16548b2a222c8ab43ae35651d069af4191836c6 (patch) | |
tree | 5731593812331226fa540186f78f5aec4aacab68 /winsup/cygwin/fhandler.cc | |
parent | e79c01f84ed5e699e7e322ee48cded403bbb6dd3 (diff) | |
download | cygnal-c16548b2a222c8ab43ae35651d069af4191836c6.tar.gz cygnal-c16548b2a222c8ab43ae35651d069af4191836c6.tar.bz2 cygnal-c16548b2a222c8ab43ae35651d069af4191836c6.zip |
* child_info.h (child_info_spawn::__stdin): New element.
(child_info_spawn::__stdin): Ditto.
(CURR_CHILD_INFO_MAGIC): Regenerate.
* dcrt0.cc (check_sanity_and_sync): Minor cleanup.
(child_info_spawn::handle_spawn): Handle new __std* elements by calling
move_fd.
* dtable.cc (dtable::move_fd): Define new function.
* dtable.h (dtable::move_fd): Declare new function.
* fhandler.h (fhandler_pipe::popen_pid): Declare new element.
* fhandler.h (fhandler_pipe::get_popen_pid): Define new function.
* fhandler.h (fhandler_pipe::set_popen_pid): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Zero popen_pid.
(fhandler_pipe::dup): Ditto.
* spawn.cc (handle): Change second argument to bool.
(spawn_guts): Accept __stdin/__stdout arguments and set them appropriately in
child_info structure and in STARTUPINFO structure.
* syscalls.cc (popen): New cygwin-specific implementation using spawn.
(pclose): Ditto.
* winsup.h (spawn_guts): Accommodate new arguments for spawn_guts.
* fhandler.cc (fhandler_base::set_no_inheritance): Make second arg a bool.
* fhandler.h (fhandler_base::set_no_inheritance): Ditto for declaration.
* child_info.h (child_info::msv_count): Rename from the now-inappropriate
"zero".
(child_info_spawn::filler): Add filler to work around Vista bug.
(child_info_fork::filler): Ditto.
* dcrt0.cc (get_cygwin_startup_info): Remove "zero" check since it is now
always filled out.
* fork.cc (frok::parent): Move ch.zero manipulation to constructor.
* spawn.cc (spawn_guts): Ditto. Remove _ch wrapper.
* sigproc.cc (child_info::child_info): Initialize starter[].
* shared.cc (shared_info::heap_slop_size): Remove noisy system_printfs.
* shared_info.h (CURR_SHARED_MAGIC): Regenerate.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index f6882e874..5070855dd 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1534,19 +1534,23 @@ fhandler_dev_null::open (int flags, mode_t mode) } void -fhandler_base::set_no_inheritance (HANDLE &h, int not_inheriting) +fhandler_base::set_no_inheritance (HANDLE &h, bool not_inheriting) { - HANDLE oh = h; - /* Note that we could use SetHandleInformation here but it is not available - on all platforms. Test cases seem to indicate that using DuplicateHandle - in this fashion does not actually close the original handle, which is - what we want. If this changes in the future, we may be forced to use - SetHandleInformation on newer OS's */ - if (!DuplicateHandle (hMainProc, oh, hMainProc, &h, 0, !not_inheriting, - DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) - debug_printf ("DuplicateHandle failed, %E"); - if (oh != h) - VerifyHandle (h); + if (wincap.has_set_handle_information ()) + { + if (!SetHandleInformation (h, HANDLE_FLAG_INHERIT, not_inheriting ? 0 : HANDLE_FLAG_INHERIT)) + debug_printf ("SetHandleInformation failed, %E"); + } + else + { + HANDLE oh = h; + if (!DuplicateHandle (hMainProc, oh, hMainProc, &h, 0, !not_inheriting, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) + debug_printf ("DuplicateHandle failed, %E"); + + if (oh != h) + VerifyHandle (h); + } #ifdef DEBUGGING_AND_FDS_PROTECTED if (h) setclexec (oh, h, not_inheriting); |