From 84a8415357713f5ef364f2ff5b918a7963895aa8 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 22 Oct 2018 10:17:38 +0000 Subject: [PATCH] - check that the dnstap socket file can be opened and exists, print error if not. git-svn-id: file:///svn/unbound/trunk@4943 be551aaa-1e26-0410-a405-d3ace91eadb9 --- dnstap/dnstap.c | 15 +++++++++++++++ doc/Changelog | 2 ++ 2 files changed, 17 insertions(+) diff --git a/dnstap/dnstap.c b/dnstap/dnstap.c index 5d0420f6f..631ccd7ad 100644 --- a/dnstap/dnstap.c +++ b/dnstap/dnstap.c @@ -39,6 +39,8 @@ #include "config.h" #include #include +#include +#include #include "sldns/sbuffer.h" #include "util/config_file.h" #include "util/net_help.h" @@ -118,6 +120,18 @@ dt_msg_init(const struct dt_env *env, } } +/* check that the socket file can be opened and exists, print error if not */ +static void +check_socket_file(const char* socket_path) +{ + struct stat statbuf; + memset(&statbuf, 0, sizeof(statbuf)); + if(stat(socket_path, &statbuf) < 0) { + log_warn("could not open dnstap-socket-path: %s, %s", + socket_path, strerror(errno)); + } +} + struct dt_env * dt_create(const char *socket_path, unsigned num_workers) { @@ -134,6 +148,7 @@ dt_create(const char *socket_path, unsigned num_workers) socket_path); log_assert(socket_path != NULL); log_assert(num_workers > 0); + check_socket_file(socket_path); env = (struct dt_env *) calloc(1, sizeof(struct dt_env)); if (!env) diff --git a/doc/Changelog b/doc/Changelog index 3002473f1..0f2372b84 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ 22 October 2018: Wouter - Fix #4192: unbound-control-setup generates keys not readable by group. + - check that the dnstap socket file can be opened and exists, print + error if not. 22 October 2018: Ralph - Change fast-server-num default to 3. -- 2.47.3