[PATCH] Fix readdir_r with long file names
Paul Eggert
eggert@cs.ucla.edu
Wed Mar 2 17:44:00 GMT 2016
Florian Weimer wrote:
> Just to be clear, you looked at the wrong struct dirent definition for
> GNU/Linux, there is a sysdeps override.
Yes, we'd need a similar fix in sysdeps/unix/sysv/linux/bits/dirent.h.
> Right now, most programs relying on sizeof (struct dirent) work well in
> almost all cases. We really don't want to break that. There appears to
> be an overlap between these programs and users of readdir_r, so once we
> remove that from the API, we should have better story for struct dirent
> declarators as well.
I see your point in worrying about GNU/Linux programs that use 'sizeof
(struct dirent)', even though these programs are not portable and won't
work on other POSIX platforms.
How about something like the attached (untested) patch, then? It keeps
the structure the same size, while still using flexible arrays to
indicate to analyzers that the array in question may be larger. It also
adds a compile-time option (default off) to simply use flexible arrays
without the backwards-compatibility hack. We could use that option in
Gnulib.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flexarray.diff
Type: text/x-patch
Size: 5842 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160302/ee697143/attachment.bin>
More information about the Libc-alpha
mailing list