In article <p5tf0t$cv4$1...@blaine.gmane.org>,
Will Parsons<firstname.lastname@example.org> wrote:
> I know it's fun to come up with a patch to fix a supposed problem with
> a widely-employed piece of software, but stop for a minute and think
> about what you're attempting to "achieve".
> If successful, you will add just another piece of bloat (that is
> subject to error and will have to be tested) to dnsmasq to address a
> problem that is not in fact dnsmasq's, but a misconfiguration problem
> at the *user's* end.
The code already exists in dnsmasq, it just doesn't work properly.
This is the block of code in question (around line 235 in src/inotify.c):
/* ignore emacs backups and dotfiles */
if (in->len == 0 ||
in->name[in->len - 1] == '~' ||
(in->name == '#' && in->name[in->len - 1] == '#') ||
in->name == '.')
What it's trying to do, is ignore any file whose last characeter is a '~',
or first and last characters are '#', or first character is '.'.
However, it's incorrectly using 'in->len', assuming this indicates the
length of the file name. However, it actually indicates the length of the
*buffer* containing the file name (which appears to be being allocated in
something like 16 byte chunks).
The patch is simply replacing 'in->len - 1' with 'strlen(in->name) - 1' (on
two lines) to correctly get the last character from the name, so it's hardly
adding 'bloat', it's merely fixing functionality that has already been
attempted but implemented incorrectly.
Dnsmasq-discuss mailing list