Re: readdir_r considered harmful

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

 



>The Austin Group should amend POSIX and the SUS in one or more of the
>following ways:
>
>1.  Standardise the dirfd function from BSD and recommend its use in
>    determining the buffer size for readdir_r.
>2.  Specify a new variant of readdir in which the buffer size is explicit
>    and the function returns an error code if the buffer is too small.
>3.  Specify that NAME_MAX must be defined as the length of the longest
>    name that can be used on any filesystem.  (This seems to be what many
>    or most implementations attempt to do at present, although POSIX
>    currently specifies otherwise.)


Why not:

4. Require the readdir() implementation to use state local to dirp.

I've never understood the rationale behind readdir_r; it's like someone
went through the manual looking for "pointers to static locations"
and defined new functions with _r for each of them, suspending thinking.

But perhaps people can look at how their readdir() implementations
behave.  The Solaris implementation appears to be "unshared dirp safe".

Casper

[Index of Archives]     [Linux Security]     [Netfilter]     [PHP]     [Yosemite News]     [Linux Kernel]

  Powered by Linux