lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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."
> http://www.opengroup.org/onlinepubs/009695399/functions/tmpnam.html

The Linux man page makes a slightly stronger statement:

- ---snip---
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.
- ---snip---

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...

- --
┌─── dg@cowlark.com ───── 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

iD8DBQFHwCAdf9E0noFvlzgRAvsrAKDOGJpjM0zd2cLzbzMYIYLc/OdItgCfczNS
O57DvRIc7SHdxq0rTK3BARs=
=+vDv
-----END PGP SIGNATURE-----