[PATCH] Fix readdir_r with long file names

Florian Weimer fweimer@redhat.com
Tue Jun 11 07:51:00 GMT 2013


On 06/11/2013 12:36 AM, Roland McGrath wrote:
>> There's precedent for my approach in realpath, where we don't use
>> pathconf(path, _PC_PATH_MAX), either, but cap the path length at PATH_MAX.
>
> That's just following vanilla POSIX.1 rules: if PATH_MAX is defined at
> compile time, it's a fixed system-wide limit.  If PATH_MAX is not defined
> at compile time, there might or might not be a limit and if there is a
> limit it might be filesystem-specific; pathconf reports that.

We must continue to define PATH_MAX and NAME_MAX for backwards 
compatibility reasons.  This leads to ugly kludges when we're confronted 
with data from the kernel that exceeds the constants.  (getwd is another 
such place.)

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Libc-alpha mailing list