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:
authorCorinna Vinschen <corinna@vinschen.de>2004-03-31 14:10:59 +0400
committerCorinna Vinschen <corinna@vinschen.de>2004-03-31 14:10:59 +0400
commit93ba120429991bd12645ef9c87e44d7464be75bb (patch)
tree879bd5494d8fc62055465693e0a8599fb1ae353a
parent4450172a6c9a97bf9ec6ec1504f0297defe47cb4 (diff)
* fhandler_socket.cc (fhandler_socket::sendmsg): Add SIGPIPE handling.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/fhandler_socket.cc13
2 files changed, 17 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 0f75ddd48..27b0d7306 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,9 @@
2004-03-31 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler_socket.cc (fhandler_socket::sendmsg): Add SIGPIPE handling.
+
+2004-03-31 Corinna Vinschen <corinna@vinschen.de>
+
* fhandler_socket.cc (fhandler_socket::recvfrom): Initialize res to
SOCKET_ERROR. Use SOCKET_ERROR instead of -1 throughout.
(fhandler_socket::recvmsg): Ditto.
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index ccc1bef77..a410e15ac 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -1100,6 +1100,19 @@ fhandler_socket::sendmsg (const struct msghdr *msg, int flags, ssize_t tot)
res = ret;
}
+ /* Special handling for EPIPE and SIGPIPE.
+
+ EPIPE is generated if the local end has been shut down on a connection
+ oriented socket. In this case the process will also receive a SIGPIPE
+ unless MSG_NOSIGNAL is set. */
+ if (res == SOCKET_ERROR && get_errno () == ESHUTDOWN
+ && get_socket_type () == SOCK_STREAM)
+ {
+ set_errno (EPIPE);
+ if (! (flags & MSG_NOSIGNAL))
+ raise (SIGPIPE);
+ }
+
return res;
}