[PATCH] misc: Add mkostempat (BZ 19866)

Florian Weimer fweimer@redhat.com
Fri Jun 26 07:23:37 GMT 2026


* Paul Eggert:

> On 2026-06-25 14:59, Mark Wielaard wrote:
>> If not, can we have a simple mkstempat one that just adds the dirfd
>> argument, but doesn't try to fix any other issue?
>
> We could, but there is always one more feature that people want. For
> example, if/when Linux adds O_CREAT|O_DIRECTORY support to openat2, or
> a mkdirat2 API (or whatever), we'll need yet another function to make
> this new kernel facility available in the mkdtemp family.
>
> In the end it's simpler to have a function with a callback.

Splitting probing and name creation has the same problem as tmpnam:
creation might not use O_EXCL (either explicitly or implicitly).  It
seems to me that a callback-based interface mostly serves to obfuscate
the relationship to the deprecated tmpnam function.

We can acknowledge that deprecating tmpnam was a mistake and introduce a
tmpnamat function.  Not splitting probing and creation introduces a
proliferation of interfaces.  I think this would be cleaner than the
callback-based approach, and easier to consume from languages such as
Python.

Thanks,
Florian



More information about the Libc-alpha mailing list