Chad Walstrom wrote:
On Wed, Apr 27, 2005 at 11:01:45AM -0400, Mike O'Dell wrote:
if i were to hazzard a guess, the reason the code doesn't use
mkstemp() is that [1] the code cited is likely well more than twice
age of mkstemp() [2]and nobody has gone looking for things to fix
that were still (apparently) working. (big grin)
In sbr/m_scratch.c, it looks like there's a comment made by "Doug"
with respect to postponing the mkstemp(3) work until "later".
Additionally, looking at the manpage for mkstemp(3) on a GNU/Linux
system reports this note::
"Don't use this function, use tmpfile(3) instead. It is better
defined and more portable."
Neither tmpfile(3) nor mkstemp(3) give a file name as a return value,
rather a file stream or file descriptor, respectively. This breaks
the use of a temp file as a staging area for a potentially permanent
file (ala rename(2) or link(2)) and would require a more extensive
rewrite of the nmh utilities.
mkstemp is more like the usage of mktemp, and is portable. mkstemp has
been a part of POSIX since 2001. It's already used in various places in
the nmh source (search for it). The tmpfile specification doesn't
guarantee that the file will be unique, but on most non ancient libc's,
it should be.
The biggest advantage of mkstemp is that it gives you back the name of
the temp file it just created, tempfile doesn't.
--
JB
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers