Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 2025 20:09:33 +0100
From:      rb@gid.co.uk
To:        =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@FreeBSD.org>
Cc:        Olivier Certner <olce@FreeBSD.org>, FreeBSD Current <freebsd-current@FreeBSD.org>, Alan Somers <asomers@FreeBSD.org>, Toomas Soome <tsoome@me.com>
Subject:   Re: git: d549de769055 - main - libc: Remove readdir_r(3) [This broke building rust 1.88]
Message-ID:  <C8B6CB35-4B18-4C16-87D9-D2F19086C581@gid.co.uk>
In-Reply-To: <86qzwcgcmp.fsf@ltc.des.dev>
References:  <C79DD894-11FD-4919-B3EE-147978D36AF8@me.com> <CAOtMX2gS54kMJMsudth5AzCSWzELgP5o8%2B8gQ5ac2P3mcSVG%2BA@mail.gmail.com> <4148862.BRNeRiNLvY@ravel> <0F481EDD-24F4-4F2C-BCBB-9B016DD313F3@gid.co.uk> <86qzwcgcmp.fsf@ltc.des.dev>

index | next in thread | previous in thread | raw e-mail

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






home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C8B6CB35-4B18-4C16-87D9-D2F19086C581>