- 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
This commit is contained in:
Wouter Wijngaards 2018-10-22 10:17:38 +00:00
parent 6429b5c298
commit 84a8415357
2 changed files with 17 additions and 0 deletions

View file

@ -39,6 +39,8 @@
#include "config.h"
#include <string.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <errno.h>
#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)

View file

@ -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.