diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-09-24 18:56:35 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-09-25 16:41:31 +0200 |
commit | 933d9c6b0743a903324b853a516c55eab883774a (patch) | |
tree | b3fb78bfbc591c410613268fd65073e37b5e3ce8 | |
parent | 0f0eb05e03d3df18c0d1fbc1ee034de2b4b244d1 (diff) | |
download | libssh-933d9c6b0743a903324b853a516c55eab883774a.tar.gz libssh-933d9c6b0743a903324b853a516c55eab883774a.tar.xz libssh-933d9c6b0743a903324b853a516c55eab883774a.zip |
socket: Pass MSG_NOSIGNAL to send()
This avoid that we get a SIGPIPE.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 1e5e09563a4e3b6f094e2634c1453dd4d56e798c)
-rw-r--r-- | src/socket.c | 7 |
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); } |