Use strlen to determine the length of the filename returned by
inotify, as in->len refers to the length of the buffer containing
the name, not the length of the name itself.

http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2018q1/011950.html

Signed-off-by: Andy Hawkins <a...@gently.org.uk>
---
 src/inotify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/inotify.c b/src/inotify.c
index eda1d56..45c730a 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -235,8 +235,8 @@ int inotify_check(time_t now)
 
          /* ignore emacs backups and dotfiles */
          if (in->len == 0 || 
-             in->name[in->len - 1] == '~' ||
-             (in->name[0] == '#' && in->name[in->len - 1] == '#') ||
+             in->name[strlen(in->name) - 1] == '~' ||
+             (in->name[0] == '#' && in->name[strlen(in->name) - 1] == '#') ||
              in->name[0] == '.')
            continue;
          
-- 
2.11.0


_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to