From 4fc199ac4095bbe0de4f28d8f67f327f2e15f851 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 6 Aug 2016 03:07:11 +0200 Subject: Use MSG_NOSIGNAL when sending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libcoopgamma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c index b72e856..2a9879b 100644 --- a/src/libcoopgamma.c +++ b/src/libcoopgamma.c @@ -1475,9 +1475,11 @@ int libcoopgamma_flush(libcoopgamma_context_t* restrict ctx) { sendsize = ctx->outbound_head - ctx->outbound_tail; sendsize = sendsize < chunksize ? sendsize : chunksize; - sent = send(ctx->fd, ctx->outbound + ctx->outbound_tail, sendsize, 0); + sent = send(ctx->fd, ctx->outbound + ctx->outbound_tail, sendsize, MSG_NOSIGNAL); if (sent < 0) { + if (errno == EPIPE) + errno = ECONNRESET; if (errno != EMSGSIZE) return -1; if ((chunksize >>= 1) == 0) -- cgit v1.2.3-70-g09d2