This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mktemp + openat and related questions


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/

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]