Bob Bishop <[email protected]> writes: > And while I’m here, POSIX.1 defines for readdir_r (and readdir): > > [EOVERFLOW] > One of the values in the structure to be returned cannot be represented > correctly. > > …which I think would cover the case of indeterminate NAME_MAX/PATH_MAX for > readdir_r.
No, because readdir_r() has no way of knowing the size of the buffer that was passed to it. Moreover, our readdir_r() is a wrapper around our readdir(), so if the reason you're using readdir_r() is that you consider readdir() unsafe, congratulations, you played yourself. The only argument in favor of readdir_r() was thread safety because some readdir() implementations used to return a pointer to a static buffer, but was never the case for FreeBSD. Our readdir() is thread-safe as long as you don't have multiple threads operating on the same DIR. DES -- Dag-Erling Smørgrav - [email protected]
