Improve logging of DNS record source from --hostsdir files.

Patch author Dominik Derigs <dl6er@dl6er.de> with subsequent bugfixes
and tweaks from Simon Kelley.
This commit is contained in:
Dominik Derigs
2022-10-16 21:08:30 +01:00
committed by Simon Kelley
parent a176cf1bc3
commit 0ba25a0512
4 changed files with 119 additions and 65 deletions

View File

@@ -1861,6 +1861,7 @@ void dump_cache(time_t now)
char *record_source(unsigned int index)
{
struct hostsfile *ah;
struct dyndir *dd;
if (index == SRC_CONFIG)
return "config";
@@ -1872,9 +1873,11 @@ char *record_source(unsigned int index)
return ah->fname;
#ifdef HAVE_INOTIFY
for (ah = daemon->dynamic_dirs; ah; ah = ah->next)
if (ah->index == index)
return ah->fname;
/* Dynamic directories contain multiple files */
for (dd = daemon->dynamic_dirs; dd; dd = dd->next)
for (ah = dd->files; ah; ah = ah->next)
if (ah->index == index)
return ah->fname;
#endif
return "<unknown>";