changeset 14624:e00c934ee25d

mkstemp: mention clean-temp module * lib/mkstemp.c: Add comment. * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
author Reuben Thomas <rrt@sc3d.org>
date Wed, 27 Apr 2011 14:30:31 +0100
parents 623e25e9826b
children 1a2352cb014f
files ChangeLog doc/posix-functions/mkstemp.texi lib/mkstemp.c
diffstat 3 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-27  Reuben Thomas  <rrt@sc3d.org>
+	and Eric Blake  <eblake@redhat.com>
+
+	mkstemp: mention clean-temp module
+	* lib/mkstemp.c: Add comment.
+	* doc/posix-functions/mkstemp.texi (mkstemp): Likewise.
+
 2011-04-26  Paul Eggert  <eggert@cs.ucla.edu>
 
 	inttypes: also provide default values for 32-bit tests
--- a/doc/posix-functions/mkstemp.texi
+++ b/doc/posix-functions/mkstemp.texi
@@ -24,3 +24,6 @@
 world or group writable or readable file, if you haven't set the process
 umask to 077.  This is a security risk.
 @end itemize
+
+The gnulib module clean-temp can create temporary files that are less
+likely to be left behind on signals such as SIGINT.
--- a/lib/mkstemp.c
+++ b/lib/mkstemp.c
@@ -38,7 +38,11 @@
 /* Generate a unique temporary file name from XTEMPLATE.
    The last six characters of XTEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the file name unique.
-   Then open the file and return a fd. */
+   Then open the file and return a fd.
+
+   If you are creating temporary files which will later be removed,
+   consider using the clean-temp module, which avoids several pitfalls
+   of using mkstemp directly. */
 int
 mkstemp (char *xtemplate)
 {