Index: fhandler_socket.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/fhandler_socket.cc,v retrieving revision 1.41 diff -u -p -r1.41 fhandler_socket.cc --- fhandler_socket.cc 2002/03/05 18:02:53 1.41 +++ fhandler_socket.cc 2002/03/20 11:30:36 @@ -343,14 +343,8 @@ fhandler_socket::close () int res = 0; sigframe thisframe (mainthread); - /* HACK to allow a graceful shutdown even if shutdown() hasn't been - called by the application. Note that this isn't the ultimate - solution but it helps in many cases. */ - struct linger linger; - linger.l_onoff = 1; - linger.l_linger = 240; /* seconds. default 2MSL value according to MSDN. */ - setsockopt (get_socket (), SOL_SOCKET, SO_LINGER, - (const char *)&linger, sizeof linger); + if (!saw_shutdown_read () && !saw_shutdown_write ()) + shutdown(get_socket (),SD_BOTH); while ((res = closesocket (get_socket ())) != 0) {