diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-07-27 09:11:38 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-07-27 09:11:38 +0000 |
commit | 9869e006f3ac34d7bd67fb6327f3605725995abc (patch) | |
tree | a4649e2504fc1caae8493a2583962aacd1cd737e /winsup/cygwin/net.cc | |
parent | 40f67ea198cf8b2bd27e87614065717613b2ff8b (diff) | |
download | newlib-9869e006f3ac34d7bd67fb6327f3605725995abc.zip newlib-9869e006f3ac34d7bd67fb6327f3605725995abc.tar.gz newlib-9869e006f3ac34d7bd67fb6327f3605725995abc.tar.bz2 |
* fhandler.h (class fhandler_socket): Remove prot_info_ptr.
(fhandler_socket::fixup_before_fork_exec): Remove.
(fhandler_socket::fixup_after_exec): Remove.
(fhandler_socket::need_fixup_before): Remove.
* fhandler_socket.cc (fhandler_socket::fhandler_socket): Drop
initializing prot_info_ptr. Remove unused code.
(fhandler_socket::~fhandler_socket): Drop free'ing prot_info_ptr.
(struct wsa_event): Rename connect_errorcode to errorcode.
(fhandler_socket::evaluate_events): Handle FD_CLOSE error condition
as FD_CONNECT error condition, except, never reset an FD_CLOSE error
condition. Always set FD_WRITE after successfully recorded FD_CONNECT.
(fhandler_socket::fixup_before_fork_exec): Remove.
(fhandler_socket::fixup_after_fork): Revert to using handle duplication.
(fhandler_socket::fixup_after_exec): Remove.
(fhandler_socket::dup): Revert to using handle duplication.
(fhandler_socket::send_internal): Only call wait_for_events in case
of WSAEWOULDBLOCK condition.
(fhandler_socket::set_close_on_exec): Call
fhandler_base::set_close_on_exec.
* net.cc (fdsock): Just set socket to inheritable on non-NT. Don't
call inc_need_fixup_before.
* select.cc (peek_socket): Don't set except_ready on every FD_CLOSE,
just on error.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r-- | winsup/cygwin/net.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 80f34a8..87a4135 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -501,14 +501,16 @@ cygwin_getprotobynumber (int number) bool fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc) { - if (wincap.has_set_handle_information ()) + /* NT systems apparently set sockets to inheritable by default */ + if (!wincap.has_set_handle_information () + && !DuplicateHandle (hMainProc, (HANDLE) soc, + hMainProc, (HANDLE *) &soc, + 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) { - /* NT systems apparently set sockets to inheritable by default */ - SetHandleInformation ((HANDLE) soc, HANDLE_FLAG_INHERIT, 0); - debug_printf ("reset socket inheritance"); + debug_printf ("set socket inheritance failed, %E"); + return false; } - else - debug_printf ("not setting socket inheritance"); fd = build_fh_dev (*dev); if (!fd.isopen ()) return false; @@ -517,7 +519,6 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc) return false; fd->set_flags (O_RDWR | O_BINARY); fd->uninterruptible_io (true); - cygheap->fdtab.inc_need_fixup_before (); debug_printf ("fd %d, name '%s', soc %p", (int) fd, dev->name, soc); #if 0 /* Same default buffer sizes as on Linux (instead of WinSock default 8K). |