------- Comment #6 from burnus at gcc dot gnu dot org 2010-04-22 09:21 -------
Created an attachment (id=20460)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20460&action=view)
Draft patch for GetTempPath; fix for mktemp
(In reply to comment #2)
> The if and do .. while block may execute mktemp more than once. ??
I think the idea is: If a file has been created between calling mktemp and
calling open (race condition), it tries again with a new file name. I think
that part looks - in principle - fine.
* * *
Kai has found the issue:
while (!(fd == -1 && errno == EEXIST) && mktemp (template));
The NOT ("!") is wrong - the condition should be:
while (fd == -1 && errno == EEXIST && mktemp (template));
This should be checked into 4.4/4.5/4.6.
* * *
Additionally, I tried to get GetTempPath working, but that draft might not even
compile. That would be for 4.6 only.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43844