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 1e5e09563a)
This commit is contained in:
Andreas Schneider
2018-09-24 18:56:35 +02:00
parent 0f0eb05e03
commit 933d9c6b07

View File

@@ -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);
}