]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #59, when compiled with systemd support check that we can properly
authorGeorge Thessalonikefs <george@nlnetlabs.nl>
Wed, 14 Aug 2019 13:51:28 +0000 (15:51 +0200)
committerGeorge Thessalonikefs <george@nlnetlabs.nl>
Wed, 14 Aug 2019 13:51:28 +0000 (15:51 +0200)
  communicate with systemd through the `NOTIFY_SOCKET`.

daemon/daemon.c
doc/Changelog

index 7461a26e210422ceb0a158d9db028b91888dc1e6..3219d3095bcbbd3d43cb480191655aef7041e5bd 100644 (file)
@@ -575,6 +575,7 @@ void
 daemon_fork(struct daemon* daemon)
 {
        int have_view_respip_cfg = 0;
+       int ret;
 
        log_assert(daemon);
        if(!(daemon->views = views_create()))
@@ -660,7 +661,12 @@ daemon_fork(struct daemon* daemon)
 
        /* Start resolver service on main thread. */
 #ifdef HAVE_SYSTEMD
-       sd_notify(0, "READY=1");
+       ret = sd_notify(0, "READY=1");
+       if(ret <= 0 && getenv("NOTIFY_SOCKET"))
+               fatal_exit("sd_notify failed %s: %s. Make sure that unbound has "
+                               "access/permission to use the socket presented by systemd.",
+                               getenv("NOTIFY_SOCKET"),
+                               (ret==0?"no $NOTIFY_SOCKET": strerror(-ret)));
 #endif
        log_info("start of service (%s).", PACKAGE_STRING);
        worker_work(daemon->workers[0]);
index 3b6ed46f7cce3b760658baa8a0451aa9895724fa..36909725aa8d2b903a1868027c2303ed6e81e34c 100644 (file)
@@ -1,3 +1,7 @@
+14 August 2019: George
+       - Fix #59, when compiled with systemd support check that we can properly
+         communicate with systemd through the `NOTIFY_SOCKET`.
+
 14 August 2019: Wouter
        - Generate configlexer with newer flex.