diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-05-27 07:50:00 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-05-27 07:50:00 +0000 |
commit | dae86e4507ca652a9222f3e61f2ebc65502ea119 (patch) | |
tree | 38770a7b58399b264203f684c0bb892fffd8f827 | |
parent | 2311f6b0e4d977492d54f6f3d3aa781fc56495ac (diff) | |
download | cygnal-dae86e4507ca652a9222f3e61f2ebc65502ea119.tar.gz cygnal-dae86e4507ca652a9222f3e61f2ebc65502ea119.tar.bz2 cygnal-dae86e4507ca652a9222f3e61f2ebc65502ea119.zip |
* fhandler_socket.cc (fhandler_socket::dup): First try duplicating
using WSADuplicateSocket/WSASocket, if that fails, try DuplicateHandle.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 15 |
2 files changed, 13 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 47523dce5..5b769c942 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2003-05-27 Corinna Vinschen <corinna@vinschen.de> + + * fhandler_socket.cc (fhandler_socket::dup): First try duplicating + using WSADuplicateSocket/WSASocket, if that fails, try DuplicateHandle. + 2003-05-27 Bill C. Riemers <cygwin@docbill.net> * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Filter diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index c3c7b9a89..45b8bc12b 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -393,15 +393,16 @@ fhandler_socket::dup (fhandler_base *child) drop this for NT systems at all and return to the good ol' DuplicateHandle way of life. This worked fine all the time on NT anyway and it's even a bit faster. */ - if (!wincap.has_security ()) + WSASetLastError (0); + fhs->fixup_before_fork_exec (GetCurrentProcessId ()); + if (WSAGetLastError () != WSAEINVAL && winsock2_active) { - fhs->fixup_before_fork_exec (GetCurrentProcessId ()); - if (winsock2_active) - { - fhs->fixup_after_fork (hMainProc); - return get_io_handle () == (HANDLE) INVALID_SOCKET; - } + fhs->fixup_after_fork (hMainProc); + if (WSAGetLastError () != WSAEINVAL) + return get_io_handle () == (HANDLE) INVALID_SOCKET; } + + debug_printf ("WSADuplicateSocket failed, trying DuplicateHandle"); /* We don't call fhandler_base::dup here since that requires to have winsock called from fhandler_base and it creates only inheritable sockets which is wrong for winsock2. */ |