From: Vladimír Čunát Date: Mon, 13 Nov 2017 09:24:53 +0000 (+0100) Subject: daemon: block SIGPIPE X-Git-Tag: v1.5.1~25^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ba2a5e85866ec21044122e8c2835afdc8be8a7b;p=thirdparty%2Fknot-resolver.git daemon: block SIGPIPE We can ignore the signal, as the affected libuv calls report error by returning EPIPE anyway. Fixes https://gitlab.labs.nic.cz/knot/knot-resolver/issues/271 --- diff --git a/NEWS b/NEWS index fc8691834..8a4c09668 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +Knot Resolver 1.5.1 (2017-1x-yy) +================================ + +Bugfixes +-------- +- fix SIGPIPE crashes + + Knot Resolver 1.5.0 (2017-11-02) ================================ diff --git a/daemon/main.c b/daemon/main.c index 56c2e85a1..f70c441f2 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -640,6 +641,14 @@ int main(int argc, char **argv) } } + /* Workaround for https://github.com/libuv/libuv/issues/45 + * (Write after ECONNRESET crash.) */ + if (ret && signal(SIGPIPE, SIG_IGN) == SIG_ERR) { + kr_log_error("[system] can't block SIGPIPE signal: %s\n", + strerror(errno)); + ret = EXIT_FAILURE; + } + if (ret != 0) { goto cleanup; }