octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting rid of tempnam / tempname / mktemp ?


From: CdeMills
Subject: getting rid of tempnam / tempname / mktemp ?
Date: Thu, 13 Jan 2011 14:24:01 -0800 (PST)

According to glibc doc, those three functions MAY be victim of race, between
the path name generation and the file opening. The suggestion is to use
mkstemp instead, which create the name, open the file and fails if the file
can't be opened with the O_EXCL flag. 

octave_tempname is used in a few places. Substituing mkstemp introduces the
problem that its return value is an int (low-level file IO), while a stream
is expected. In C, a file descriptor may be transformed into a stream
through fdopen. Can it be used in C++ ? I mean, can the FILE * from fdopen
be transformed into a C++ stream ?

Regards

Pascal 
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/getting-rid-of-tempnam-tempname-mktemp-tp3216827p3216827.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]