diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2004-03-31 10:10:59 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2004-03-31 10:10:59 +0000 |
commit | 93ba120429991bd12645ef9c87e44d7464be75bb (patch) | |
tree | 879bd5494d8fc62055465693e0a8599fb1ae353a /winsup/cygwin/fhandler_socket.cc | |
parent | 4450172a6c9a97bf9ec6ec1504f0297defe47cb4 (diff) | |
download | cygnal-93ba120429991bd12645ef9c87e44d7464be75bb.tar.gz cygnal-93ba120429991bd12645ef9c87e44d7464be75bb.tar.bz2 cygnal-93ba120429991bd12645ef9c87e44d7464be75bb.zip |
* fhandler_socket.cc (fhandler_socket::sendmsg): Add SIGPIPE handling.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 13 |
1 files changed, 13 insertions, 0 deletions
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; } |