
Guillaume wrote:
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
Le mar 20/07/2004 ` 08:06, Vladimir Prus a icrit : 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

Le mar 20/07/2004 à 17:43, Robert Ramey a écrit :
So what course of action do you recommend?
I already said what I thought about it almost one week ago (I was the one who started this thread after all). And I haven't changed my mind about it. http://lists.boost.org/MailArchives/boost/msg67345.php To summarize: don't bother trying to create a temporary file, just create a file in the current directory and give it an explicit name (and erase it when you are finished). At this stage of a release, you just want the tests to build without complaint from the linker. I'm not asking for more till the release. Then, after the release, somebody can try to come with a secure solution (in the filesystem library maybe?). Regards, Guillaume
participants (2)
-
Guillaume Melquiond
-
Robert Ramey