|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2004-07-20 10:43:19
Guillaume wrote:
>Le mar 20/07/2004 ` 08:06, Vladimir Prus a icrit :
>> Robert Ramey wrote:
>> > >> [1] As does the manpage say: "Never use this function".
>> > >
>> > >Depending on the version, you may even see a more helpful message in
>the
>> > >manpage.
>> > >
>> > >
>> > >BUGS
>> > > Never use this function. Use mkstemp(3) instead.
>> >
>> > Well, not helpful enough. Making a stream from a file descriptor is
code I
>> > don't have.
>>
>> Maybe, you should take a look at the code I've posted... you don't need
>to
>> create fstream from file descriptor. You can open the file using the name
>> mkstemp returns via the in/out parameter.
>No, using mkstemp this way is no different than using tmpnam. Even if
>the file is already open, there is no reason for it to still be linked
>in the directory. So you may end up with a different file, and chaos
>ensues.
So what course of action do you recommend?
Also, as I understand the problem, If I don't use tmpnam but just assign a
fixed name like "xyz", the same issues re race conditions and potential
flaws are still present - are they not?
This is sort of an interesting question but seems way beyond the scope of
what can be addressed by a program whose function is to test a library
during development. Perhaps you want to conjure up a definitive solution
and submit for consideration as part of the filesystem library.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk