Enhance --hostdir so that records are automatically removed when re-reading.

Initial patch from Dominik Derigs, re-written by Simon Kelley.
This commit is contained in:
Dominik Derigs
2022-10-16 22:08:45 +01:00
committed by Simon Kelley
parent 0ba25a0512
commit 0017dd74d5
5 changed files with 33 additions and 2 deletions

View File

@@ -294,12 +294,16 @@ int inotify_check(time_t now)
strcat(path, "/");
strcat(path, in->name);
my_syslog(LOG_INFO, _("inotify, new or changed file %s"), path);
my_syslog(LOG_INFO, _("inotify: new, removed or changed file %s"), path);
if (dd->flags & AH_HOSTS)
{
if ((ah = dyndir_addhosts(dd, path)))
{
const unsigned int removed = cache_remove_uid(ah->index);
if (removed > 0)
my_syslog(LOG_INFO, _("flushed %u outdated entries"), removed);
read_hostsfile(path, ah->index, 0, NULL, 0);
#ifdef HAVE_DHCP
if (daemon->dhcp || daemon->doing_dhcp6)