[Dnsmasq-discuss] [PATCH] Inotify: Ignore backup files created by editors

Andy Hawkins andy at gently.org.uk
Thu Feb 15 17:14:00 GMT 2018


Hi,
In article <0f10b5dc-7504-a92a-824d-ecc091b00cc8 at thekelleys.org.uk>,
           Simon Kelley<simon at thekelleys.org.uk> wrote:
> Patch applied, with two modifications.
>
> 1) I added a check for strlen(in->name) not being zero. I don't know if
> inotify could give us a zero-length filename, but if it did, we'd make
> an out-of-bounds array reference to in->name[-1]. I also saved the
> return from strlen(in->name) in a variable, rather than call strlen
> three times.
>
> 2) Move the resolv-file test to after the dotfiles test. Only relevant
> if someone configures a resolv file name which looks like an editor
> backup file, but at least in's consistent. Also allows removal of a
> now-redundant in->len == 0 test.

Is it possible for in->len to be zero? The man page for inotify does say the
name is optional, so I assumed that this was what that test was checking
for?

I'll take a look at your version of the code in git and see how it looks
compared to mine.

Thanks

Andy




More information about the Dnsmasq-discuss mailing list