diff options
| author | Paul Eggert | 2017-08-08 09:49:40 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-08-08 09:50:15 -0700 |
| commit | 7d1115e0c792f79c9eb728bf9027053a5868ff23 (patch) | |
| tree | 6cff4fdfa736e631afeb63dc9cef8793f24566f3 | |
| parent | 846870e508021ee8d1099280b3f40fe108a34bf0 (diff) | |
| download | emacs-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.texi | 9 | ||||
| -rw-r--r-- | src/fileio.c | 3 |
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 |
| 2550 | This function generates a string that can be used as a unique file | 2550 | This function generates a string that might be a unique file |
| 2551 | name. The name starts with @var{base-name}, and has several random | 2551 | name. The name starts with @var{base-name}, and has several random |
| 2552 | characters appended to it, which are different in each Emacs job. It | 2552 | characters appended to it, which are different in each Emacs job. It |
| 2553 | is like @code{make-temp-file} except that (i) it just constructs a | 2553 | is like @code{make-temp-file} except that (i) it just constructs a |
| 2554 | name, and does not create a file, and (ii) @var{base-name} should be | 2554 | name and does not create a file, (ii) @var{base-name} should be an |
| 2555 | an absolute file name (on MS-DOS, this function can truncate | 2555 | absolute 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). | 2556 | name is magic, it might name an existing file. @xref{Magic File |
| 2557 | Names}. | ||
| 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 | ||
| 759 | This function tries to choose a name that has no existing file. | 759 | This function tries to choose a name that has no existing file. |
| 760 | For this to work, PREFIX should be an absolute file name. | 760 | For this to work, PREFIX should be an absolute file name, and PREFIX |
| 761 | and the returned string should both be non-magic. | ||
| 761 | 762 | ||
| 762 | There is a race condition between calling `make-temp-name' and creating the | 763 | There is a race condition between calling `make-temp-name' and creating the |
| 763 | file, which opens all kinds of security holes. For that reason, you should | 764 | file, which opens all kinds of security holes. For that reason, you should |