1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

socket: Pass MSG_NOSIGNAL to send()

This avoid that we get a SIGPIPE.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-09-24 18:56:35 +02:00
parent 35bf5334b8
commit 1e5e09563a

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