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>2002-03-05 21:02:53 +0300
committerChristopher Faylor <me@cgf.cx>2002-03-05 21:02:53 +0300
commiteeac69d835201c54e8fe701582b11d142bc4a2d5 (patch)
treee3eafcdad74667aed0635d4d74e1e2dc2368e1a6 /winsup/cygwin/fhandler_socket.cc
parent241a7c5a8c8662623c04163c5132ecbf5b417b3b (diff)
* fhandler_socket.cc (fhandler_socket::close): Respond to signals while
looping, waiting for socket to close. Superstitiously clear last error when WSAEWOULDBLOCK.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index cf8ec1c24..e343c9021 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -352,13 +352,21 @@ fhandler_socket::close ()
setsockopt (get_socket (), SOL_SOCKET, SO_LINGER,
(const char *)&linger, sizeof linger);
- while ((res = closesocket (get_socket ()))
- && WSAGetLastError () == WSAEWOULDBLOCK)
- continue;
- if (res)
+ while ((res = closesocket (get_socket ())) != 0)
{
- set_winsock_errno ();
- res = -1;
+ if (WSAGetLastError () != WSAEWOULDBLOCK)
+ {
+ set_winsock_errno ();
+ res = -1;
+ break;
+ }
+ if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0)
+ {
+ set_errno (EINTR);
+ res = -1;
+ break;
+ }
+ WSASetLastError (0);
}
close_secret_event ();