client: use MSG_NOSIGNAL in send(3)

MSG_NOSIGNAL  Requests not to send the SIGPIPE signal if an attempt
                to send is made on  a  stream-oriented socket that is
                no longer connected. The [EPIPE] error shall still be
                returned.
This commit is contained in:
Daniel Eklöf 2021-10-30 18:07:06 +02:00
parent cad48c1b0a
commit 4607763e79
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -46,7 +46,7 @@ sendall(int sock, const void *_buf, size_t len)
size_t left = len;
while (left > 0) {
ssize_t r = send(sock, buf, left, 0);
ssize_t r = send(sock, buf, left, MSG_NOSIGNAL);
if (r < 0) {
if (errno == EINTR)
continue;