# HG changeset patch # User Reuben Thomas # Date 1303911031 -3600 # Node ID e00c934ee25d23389e57063dc6e90d38fc83d0ce # Parent 623e25e9826b49f144b2352d747a67f7eff2c257 mkstemp: mention clean-temp module * lib/mkstemp.c: Add comment. * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. Signed-off-by: Eric Blake diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-27 Reuben Thomas + and Eric Blake + + mkstemp: mention clean-temp module + * lib/mkstemp.c: Add comment. + * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. + 2011-04-26 Paul Eggert inttypes: also provide default values for 32-bit tests diff --git a/doc/posix-functions/mkstemp.texi b/doc/posix-functions/mkstemp.texi --- 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. diff --git a/lib/mkstemp.c b/lib/mkstemp.c --- 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) {