Re: [PATCH 1/1] fs/qnx6: Fix building with GCC 15
From: Brahmajit
Date: Sun Oct 06 2024 - 19:06:13 EST
On 06.10.2024 21:00, Al Viro wrote:
> > Indeed - looks like it is checking that the first two directory entries
> > are "." and ".." in about the most complex way possible.
> >
> > I have vague recollections on some code that ignored the first two entries
> > because they 'must be "." and ".."' - and then failed because some filesystem
> > (and I can't even remember the O/S) didn't meet its expectations!
> >
> > A simple:
> > if (strcmp(dir_entry[0].de_fname, ".") || strcmp(dir_entry[1].de_fname, ".."))
> > error = 1;
> > would suffice.
>
> memcmp(), please. strcmp() is _not_ guaranteed to be safe without both being
> NUL-terminated; yes, compiler will almost simplify that in case when one of
> the arguments is a string literal, but it's better to do straight memcmp() in
> this case. It's not worth trying to be fancy there...
Hi Al,
Hi David,
Is my version 2 of the patch correct, I updated with Al's initial
recommendation (both in terms of the patch and commit). Is there
anything else that needs to be updated/added.
--
Regards,
listout