mkstemp: mention clean-temp module
authorReuben Thomas <rrt@sc3d.org>
Wed, 27 Apr 2011 13:30:31 +0000 (14:30 +0100)
committerEric Blake <eblake@redhat.com>
Wed, 27 Apr 2011 14:16:19 +0000 (08:16 -0600)
* lib/mkstemp.c: Add comment.
* doc/posix-functions/mkstemp.texi (mkstemp): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/posix-functions/mkstemp.texi
lib/mkstemp.c

index 248d0f3..247d541 100644 (file)
--- 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
index 55b42a9..5a1e145 100644 (file)
@@ -24,3 +24,6 @@ On platforms other than glibc 2.0.7 or newer, @code{mkstemp} can create a
 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.
index b0a8df3..3c8437e 100644 (file)
 /* 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)
 {