aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-08-08 09:49:40 -0700
committerPaul Eggert2017-08-08 09:50:15 -0700
commit7d1115e0c792f79c9eb728bf9027053a5868ff23 (patch)
tree6cff4fdfa736e631afeb63dc9cef8793f24566f3
parent846870e508021ee8d1099280b3f40fe108a34bf0 (diff)
downloademacs-7d1115e0c792f79c9eb728bf9027053a5868ff23.tar.gz
emacs-7d1115e0c792f79c9eb728bf9027053a5868ff23.zip
Document make-temp-name magic limitations
* doc/lispref/files.texi (Unique File Names): * src/fileio.c (Fmake_temp_name): Document that make-temp-name does not guarantee uniqueness on magic file names.
-rw-r--r--doc/lispref/files.texi9
-rw-r--r--src/fileio.c3
2 files changed, 7 insertions, 5 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 2b692dbf680..d3f40a7c0c0 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2547,13 +2547,14 @@ should compute the directory like this:
2547@end defopt 2547@end defopt
2548 2548
2549@defun make-temp-name base-name 2549@defun make-temp-name base-name
2550This function generates a string that can be used as a unique file 2550This function generates a string that might be a unique file
2551name. The name starts with @var{base-name}, and has several random 2551name. The name starts with @var{base-name}, and has several random
2552characters appended to it, which are different in each Emacs job. It 2552characters appended to it, which are different in each Emacs job. It
2553is like @code{make-temp-file} except that (i) it just constructs a 2553is like @code{make-temp-file} except that (i) it just constructs a
2554name, and does not create a file, and (ii) @var{base-name} should be 2554name and does not create a file, (ii) @var{base-name} should be an
2555an absolute file name (on MS-DOS, this function can truncate 2555absolute file name that is not magic, and (iii) if the returned file
2556@var{base-name} to fit into the 8+3 file-name limits). 2556name is magic, it might name an existing file. @xref{Magic File
2557Names}.
2557 2558
2558@strong{Warning:} In most cases, you should not use this function; use 2559@strong{Warning:} In most cases, you should not use this function; use
2559@code{make-temp-file} instead! This function is susceptible to a race 2560@code{make-temp-file} instead! This function is susceptible to a race
diff --git a/src/fileio.c b/src/fileio.c
index db760d9b22d..15845e39144 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -757,7 +757,8 @@ danger of generating a name being used by another Emacs process
757\(so long as only a single host can access the containing directory...). 757\(so long as only a single host can access the containing directory...).
758 758
759This function tries to choose a name that has no existing file. 759This function tries to choose a name that has no existing file.
760For this to work, PREFIX should be an absolute file name. 760For this to work, PREFIX should be an absolute file name, and PREFIX
761and the returned string should both be non-magic.
761 762
762There is a race condition between calling `make-temp-name' and creating the 763There is a race condition between calling `make-temp-name' and creating the
763file, which opens all kinds of security holes. For that reason, you should 764file, which opens all kinds of security holes. For that reason, you should