aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-09-24 18:56:35 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-09-25 14:37:25 +0200
commit1e5e09563a4e3b6f094e2634c1453dd4d56e798c (patch)
tree54a377708ba91e046b5432cfe850b08202adf591
parent35bf5334b8f582aa9dd123761e8129f5b2b2749d (diff)
downloadlibssh-1e5e09563a4e3b6f094e2634c1453dd4d56e798c.tar.gz
libssh-1e5e09563a4e3b6f094e2634c1453dd4d56e798c.tar.xz
libssh-1e5e09563a4e3b6f094e2634c1453dd4d56e798c.zip
socket: Pass MSG_NOSIGNAL to send()
This avoid that we get a SIGPIPE. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/socket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index d13f6ad3..2c72566d 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -589,13 +589,18 @@ static ssize_t ssh_socket_unbuffered_write(ssh_socket s,
uint32_t len)
{
ssize_t w = -1;
+ int flags = 0;
+
+#ifdef MSG_NOSIGNAL
+ flags |= MSG_NOSIGNAL;
+#endif
if (s->data_except) {
return -1;
}
if (s->fd_is_socket) {
- w = send(s->fd_out,buffer, len, 0);
+ w = send(s->fd_out, buffer, len, flags);
} else {
w = write(s->fd_out, buffer, len);
}