diff options
author | Dominik Derigs <dl6er@dl6er.de> | 2022-10-27 12:36:38 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2022-10-27 12:36:38 +0100 |
commit | 92c32e0bace9ba11bea2cb77912695da3221f656 (patch) | |
tree | 04d76350829b7403ef507219166110ede195c502 | |
parent | 1bcad678066745e98ca29dc4883241f4e5e32ac9 (diff) | |
download | dnsmasq-92c32e0bace9ba11bea2cb77912695da3221f656.tar.gz |
Do not (try to) re-read deleted files inside a --hostsdir.
-rw-r--r-- | src/inotify.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/inotify.c b/src/inotify.c index e257ec4..522f6b7 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -293,8 +293,12 @@ int inotify_check(time_t now) strcpy(path, dd->dname); strcat(path, "/"); 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) { @@ -304,7 +308,9 @@ int inotify_check(time_t now) if (removed > 0) 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 if (daemon->dhcp || daemon->doing_dhcp6) { |