diff options
author | Christopher Faylor <me@cgf.cx> | 2002-03-05 18:02:53 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-03-05 18:02:53 +0000 |
commit | eeac69d835201c54e8fe701582b11d142bc4a2d5 (patch) | |
tree | e3eafcdad74667aed0635d4d74e1e2dc2368e1a6 /winsup | |
parent | 241a7c5a8c8662623c04163c5132ecbf5b417b3b (diff) | |
download | newlib-eeac69d835201c54e8fe701582b11d142bc4a2d5.zip newlib-eeac69d835201c54e8fe701582b11d142bc4a2d5.tar.gz newlib-eeac69d835201c54e8fe701582b11d142bc4a2d5.tar.bz2 |
* 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')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 20 |
2 files changed, 20 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 48a40cd..525167c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2002-03-05 Christopher Faylor <cgf@redhat.com> + + * fhandler_socket.cc (fhandler_socket::close): Respond to signals while + looping, waiting for socket to close. Superstitiously clear last error + when WSAEWOULDBLOCK. + 2002-03-05 Robert Collins <rbtcollins@hotmail.com> * cygserver_transport_pipes.cc (transport_layer_pipes::transport_layer_pipes): diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index cf8ec1c..e343c90 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 (); |