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: @end defopt @defun make-temp-name base-name -This function generates a string that can be used as a unique file +This function generates a string that might be a unique file name. The name starts with @var{base-name}, and has several random characters appended to it, which are different in each Emacs job. It is like @code{make-temp-file} except that (i) it just constructs a -name, and does not create a file, and (ii) @var{base-name} should be -an absolute file name (on MS-DOS, this function can truncate -@var{base-name} to fit into the 8+3 file-name limits). +name and does not create a file, (ii) @var{base-name} should be an +absolute file name that is not magic, and (iii) if the returned file +name is magic, it might name an existing file. @xref{Magic File +Names}. @strong{Warning:} In most cases, you should not use this function; use @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 \(so long as only a single host can access the containing directory...). This function tries to choose a name that has no existing file. -For this to work, PREFIX should be an absolute file name. +For this to work, PREFIX should be an absolute file name, and PREFIX +and the returned string should both be non-magic. There is a race condition between calling `make-temp-name' and creating the file, which opens all kinds of security holes. For that reason, you should