From: Vsevolod Stakhov Date: Wed, 15 Oct 2014 13:21:57 +0000 (+0100) Subject: Block SIGPIPE for HTTP writing. X-Git-Tag: 0.7.2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=405109fafa0624c6f34b4faffa4c0d4d116dfded;p=thirdparty%2Frspamd.git Block SIGPIPE for HTTP writing. --- diff --git a/src/libutil/http.c b/src/libutil/http.c index c2d103b4ef..e78a798907 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -581,10 +581,12 @@ rspamd_http_write_helper (struct rspamd_http_connection *conn) struct rspamd_http_connection_private *priv; struct iovec *start; guint niov, i; + gint flags = 0; gsize remain; gssize r; GError *err; struct iovec *cur_iov; + struct msghdr msg; priv = conn->priv; @@ -613,7 +615,13 @@ rspamd_http_write_helper (struct rspamd_http_connection *conn) } } - r = writev (conn->fd, start, MIN (IOV_MAX, niov)); + memset (&msg, 0, sizeof (msg)); + msg.msg_iov = start; + msg.msg_iovlen = MIN (IOV_MAX, niov); +#ifdef MSG_NOSIGNAL + flags = MSG_NOSIGNAL; +#endif + r = sendmsg (conn->fd, &msg, flags); if (r == -1) { err =