From a90f173875baf9a40ec2f2860439f571c2f3e280 Mon Sep 17 00:00:00 2001 From: George Thessalonikefs Date: Wed, 14 Aug 2019 15:51:28 +0200 Subject: [PATCH] - Fix #59, when compiled with systemd support check that we can properly communicate with systemd through the `NOTIFY_SOCKET`. --- daemon/daemon.c | 8 +++++++- doc/Changelog | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/daemon/daemon.c b/daemon/daemon.c index 7461a26e2..3219d3095 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -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]); diff --git a/doc/Changelog b/doc/Changelog index 3b6ed46f7..36909725a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. -- 2.47.2