From: Saverio Proto Date: Fri, 8 Aug 2014 11:18:42 +0000 (+0000) Subject: MSG_NOSIGNAL option in send() will prevent SIGPIPE X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=dd19f86d9a5ceb2902239ba92cf669161a2c4477;p=meshlink MSG_NOSIGNAL option in send() will prevent SIGPIPE --- 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);