[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: os.tmpname makes empty file
- From: David Given <dg@...>
- Date: Sat, 23 Feb 2008 13:31:09 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Luiz Henrique de Figueiredo wrote:
> The POSIX specification says nothing about automatically creating the file.
> On the contrary, it says "This function only creates filenames. It
> is the application's responsibility to create and remove the files."
The Linux man page makes a slightly stronger statement:
The tmpnam() function returns a pointer to a string that is a valid
filename, and such that a file with this name did enot exist at some
point in time, so that naive programmers may think it a suitable name
for a temporary file.
Never use this function. Use mkstemp(3) or tmpfile(3) instead.
I see Robert says that io.tmpname() uses mkstemp() if available; is this
a fairly recent change? The patched 5.1.2 I'm using for Prime Mover
doesn't have this change, and it would strike me to be a good thing for
a build tool to have...
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ─────
│ "Wizards get cranky, / Dark days dawn, / Riders smell manky, / The
│ road goes on. / Omens are lowering, / Elves go West; / The Shire needs
│ scouring, / You may as well quest." - John M. Ford
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----