]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon: block SIGPIPE
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 13 Nov 2017 09:24:53 +0000 (10:24 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 13 Nov 2017 09:27:06 +0000 (10:27 +0100)
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

NEWS
daemon/main.c

diff --git a/NEWS b/NEWS
index fc86918342981bc70bed5c1adbdc08c81cb122b1..8a4c0966812d5092b1166a6083ac578dd229768d 100644 (file)
--- 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)
 ================================
 
index 56c2e85a1e9b17ce0d9d7c10d36b80a004bb3963..f70c441f2202b14741f785156b438a829c113526 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <arpa/inet.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <string.h>
 #include <getopt.h>
@@ -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;
        }