From ca1502f78a51c83c3443b3f3cdffdca39cdedf40 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Wed, 27 Apr 2011 14:30:31 +0100 Subject: [PATCH] mkstemp: mention clean-temp module * lib/mkstemp.c: Add comment. * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ doc/posix-functions/mkstemp.texi | 3 +++ lib/mkstemp.c | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 248d0f399..247d541df 100644 --- 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 index 55b42a9fe..5a1e14560 100644 --- a/doc/posix-functions/mkstemp.texi +++ b/doc/posix-functions/mkstemp.texi @@ -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. diff --git a/lib/mkstemp.c b/lib/mkstemp.c index b0a8df306..3c8437e5a 100644 --- 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) { -- 2.11.0