From dd19f86d9a5ceb2902239ba92cf669161a2c4477 Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Fri, 8 Aug 2014 11:18:42 +0000 Subject: [PATCH] MSG_NOSIGNAL option in send() will prevent SIGPIPE --- src/net_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net_socket.c b/src/net_socket.c index 34eccc96..a99849a7 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -305,7 +305,7 @@ static void handle_meta_write(meshlink_handle_t *mesh, connection_t *c) { if(c->outbuf.len <= c->outbuf.offset) return; - ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, 0); + ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, MSG_NOSIGNAL); if(outlen <= 0) { if(!errno || errno == EPIPE) { logger(DEBUG_CONNECTIONS, LOG_NOTICE, "Connection closed by %s (%s)", c->name, c->hostname); -- 2.39.2