From c702a0ee3dd199151786996579b4604a5f7b8927 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Thu, 30 May 2019 13:29:28 +0200 Subject: wip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- obinsectd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/obinsectd.c b/obinsectd.c index a8beb0e..8a14383 100644 --- a/obinsectd.c +++ b/obinsectd.c @@ -1532,12 +1532,17 @@ static int read_and_parse(int fd, unsigned char *rbuf, size_t rbuflen) /* we might have been requested to read the config file again */ if (reread_cfg) { - fds[0].revents = 0; reread_cfg = false; info("reading new configuration from '%s'\n", cfgfile); if (cfg) json_object_put(cfg); + cfg = NULL; read_config(); + + /* the publish config must be renewed too */ + if (!json_object_object_get_ex(cfg, "publish", &pubcfg)) + pubcfg = NULL; + continue; } @@ -1779,6 +1784,13 @@ static void read_config() const char *name; int i ; + /* reset before re-reading */ + current_list = NULL; + memset(log_topic, 0, sizeof(log_topic)); + + if (cfg) + json_object_put(cfg); + cfg = read_json_file(cfgfile, rbuf, bufsize); if (!cfg) return; -- cgit v1.2.3