Re: [PATCH] Fix readdir_r with long file names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/01/2016 12:27 PM, Florian Weimer wrote:
We
should implement compiler support for this wart: inhibit optimizations
(I think there are already special cases for length-0 and length-1
arrays at the end, so it's not totally without precedent), and warn
about sizeof (struct dirent) and using it as a (non-pointer) declarator.

Why not use a flexible array member for this? Sure, that assumes C99, but flexible array members are pretty much universally supported now (and we can fall back on the current layout for pre-C99 compilers). This would work better with modern compilers that treat small arrays with more respect than traditional C compilers did. And as I understand things, it would conform to POSIX (and if I'm wrong, POSIX should get fixed....).

For what it's worth, portable code cannot copy struct dirent values anyway, as this loses file names in operating systems like Solaris where d_name has size 1.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux