mktemp + openat and related questions

Carlos O'Donell carlos@systemhalted.org
Tue Mar 27 19:57:00 GMT 2012


On Tue, Mar 27, 2012 at 3:25 PM, D. V. Wiebe <dvw@phas.ubc.ca> wrote:
> On Sun, Mar 25, 2012 at 04:08:45AM -0400, Mike Frysinger wrote:
>> On Thursday 22 March 2012 16:02:31 D. V. Wiebe wrote:
>> > * The linker scolds me for using mktemp(3) and suggests I use mkstemp(3)
>> >   instead.  I'd be happy to do so but, AFAICT, it's not possible in this
>> >   situation (since I don't know the path to the directory and I need to
>> >   /at least/ make the temporary file on the same device as the directory
>> >   whose descriptor I have).  Am I right in disregarding this warning?
>>
>> you could fchdir(dir) first if the side effects aren't a problem.  but there
>> probably should be a mkstempat() func ...
>
> I need to stay threadsafe; I think that rules out fchdir.  That we
> should have a mkstempat() was my conclusion as well.  I guess I'll keep
> the state-of-the-art until it shows up.
>
> Thanks for the verification.

If there is a function that you need please file a bugzilla issue with
a use case.

We desperately need our users to clearly communicate their
requirements, otherwise we have nothing to bring to the table when
developing international standards.

I'm on SC22 for Canada and it's this kind of feedback that we need in
order to form working groups and hash out potential new features by
working with the Austin Group on POSIX issues.

Cheers,
Carlos.



More information about the Libc-help mailing list