Do not (try to) re-read deleted files inside a --hostsdir.

This commit is contained in:
Dominik Derigs
2022-10-27 12:36:38 +01:00
committed by Simon Kelley
parent 1bcad67806
commit 92c32e0bac

View File

@@ -294,7 +294,11 @@ int inotify_check(time_t now)
strcat(path, "/"); strcat(path, "/");
strcat(path, in->name); strcat(path, in->name);
my_syslog(LOG_INFO, _("inotify: new, removed or changed file %s"), path); /* Is this is a deletion event? */
if (in->mask & IN_DELETE)
my_syslog(LOG_INFO, _("inotify: %s (removed)"), path);
else
my_syslog(LOG_INFO, _("inotify: %s (new or modified)"), path);
if (dd->flags & AH_HOSTS) if (dd->flags & AH_HOSTS)
{ {
@@ -304,7 +308,9 @@ int inotify_check(time_t now)
if (removed > 0) if (removed > 0)
my_syslog(LOG_INFO, _("flushed %u outdated entries"), removed); my_syslog(LOG_INFO, _("flushed %u outdated entries"), removed);
read_hostsfile(path, ah->index, 0, NULL, 0); /* (Re-)load hostsfile only if this event isn't triggered by deletion */
if (!(in->mask & IN_DELETE))
read_hostsfile(path, ah->index, 0, NULL, 0);
#ifdef HAVE_DHCP #ifdef HAVE_DHCP
if (daemon->dhcp || daemon->doing_dhcp6) if (daemon->dhcp || daemon->doing_dhcp6)
{ {