socket: Pass MSG_NOSIGNAL to send()
This avoid that we get a SIGPIPE. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
35bf5334b8
Коммит
1e5e09563a
@ -589,13 +589,18 @@ static ssize_t ssh_socket_unbuffered_write(ssh_socket s,
|
|||||||
uint32_t len)
|
uint32_t len)
|
||||||
{
|
{
|
||||||
ssize_t w = -1;
|
ssize_t w = -1;
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
|
#ifdef MSG_NOSIGNAL
|
||||||
|
flags |= MSG_NOSIGNAL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (s->data_except) {
|
if (s->data_except) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->fd_is_socket) {
|
if (s->fd_is_socket) {
|
||||||
w = send(s->fd_out,buffer, len, 0);
|
w = send(s->fd_out, buffer, len, flags);
|
||||||
} else {
|
} else {
|
||||||
w = write(s->fd_out, buffer, len);
|
w = write(s->fd_out, buffer, len);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user