Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-10-30 10:43:46 +0300
committerChristopher Faylor <me@cgf.cx>2001-10-30 10:43:46 +0300
commit19ba6f2195b2e7f87cd1aac75cd28335ca94b1ff (patch)
tree65f4127aacd974bb288911454525e4df6c0f0a0a /winsup/cygwin/fhandler_socket.cc
parent3d4b75dec24fcf96a3047e8c75cc0f092fe7300f (diff)
* dtable.cc (dtable::dup2): Add some debugging. Use methods from passed in
class rather than cygheap->fdtab. * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Add more debugging output. (fhandler_socket::dup): Allocate new space for prot_info_ptr for duplicated entry. * syscalls.cc (stat_worker): Always delete fh if it has been created.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index ae8df07a1..9784118d5 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -169,11 +169,12 @@ fhandler_socket::fixup_before_fork_exec (DWORD win_proc_id)
debug_printf ("Without Winsock 2.0");
}
else if (!WSADuplicateSocketA (get_socket (), win_proc_id, prot_info_ptr))
- debug_printf ("WSADuplicateSocket went fine, dwServiceFlags1=%d",
- prot_info_ptr->dwServiceFlags1);
+ debug_printf ("WSADuplicateSocket went fine, sock %p, win_proc_id %d, prot_info_ptr %p",
+ get_socket (), win_proc_id, prot_info_ptr);
else
{
- debug_printf ("WSADuplicateSocket error");
+ debug_printf ("WSADuplicateSocket error, sock %p, win_proc_id %d, prot_info_ptr %p",
+ get_socket (), win_proc_id, prot_info_ptr);
set_winsock_errno ();
}
}
@@ -203,7 +204,7 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
}
else
{
- debug_printf ("WSASocket went fine %p", new_sock);
+ debug_printf ("WSASocket went fine new_sock %p, old_sock %p", new_sock, get_io_handle ());
set_io_handle ((HANDLE) new_sock);
}
@@ -230,6 +231,9 @@ fhandler_socket::dup (fhandler_base *child)
fhandler_socket *fhs = (fhandler_socket *) child;
fhs->addr_family = addr_family;
fhs->set_io_handle (get_io_handle ());
+
+ fhs->prot_info_ptr = (LPWSAPROTOCOL_INFOA)
+ cmalloc (HEAP_BUF, sizeof (WSAPROTOCOL_INFOA));
fhs->fixup_before_fork_exec (GetCurrentProcessId ());
if (winsock2_active)
{
@@ -287,11 +291,9 @@ fhandler_socket::close ()
setsockopt (get_socket (), SOL_SOCKET, SO_LINGER,
(const char *)&linger, sizeof linger);
- if (closesocket (get_socket ()))
- {
- set_winsock_errno ();
- res = -1;
- }
+ while (closesocket (get_socket ())
+ && WSAGetLastError () == WSAEWOULDBLOCK)
+ continue;
close_secret_event ();