Hi, > On 12 Sep 2025, at 11:59, Dag-Erling Smørgrav <[email protected]> wrote: > > 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.
It doesn’t need to know. If NAME_MAX is defined, the user must supply an adequately sized buffer (based on NAME_MAX) or shoot themselves in the foot. If NAME_MAX is indefinite, readdir_r() returns EOVERFLOW immediately. > […] -- Bob Bishop [email protected]
