Re: git: d549de769055 - main - libc: Remove readdir_r(3) [This broke building rust 1.88]

From: <rb_at_gid.co.uk>
Date: Fri, 12 Sep 2025 19:09:33 UTC
Hi,

> On 12 Sep 2025, at 11:59, Dag-Erling Smørgrav <des@FreeBSD.org> wrote:
> 
> Bob Bishop <rb@gid.co.uk> 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
rb@gid.co.uk