mktemp + openat and related questions
D. V. Wiebe
dvw@phas.ubc.ca
Tue Mar 27 19:25:00 GMT 2012
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.
-dvw
--
Don Wiebe dvw@phas.ubc.ca
Department of Physics and Astronomy
University of British Columbia Hennings 204
6224 Agricultural Road Tele: +1-604-822-2585
University Endowment Lands, BC
Canada V6T 1Z1 http://ketiltrout.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-help/attachments/20120327/064965f7/attachment.sig>
More information about the Libc-help
mailing list