aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c
index b7e3b71a475..69079c6ae49 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -662,17 +662,16 @@ DEFUN ("make-temp-file-internal", Fmake_temp_file_internal,
662Return the name of the generated file. If DIR-FLAG is zero, do not 662Return the name of the generated file. If DIR-FLAG is zero, do not
663create the file, just its name. Otherwise, if DIR-FLAG is non-nil, 663create the file, just its name. Otherwise, if DIR-FLAG is non-nil,
664create an empty directory. The file name should end in SUFFIX. 664create an empty directory. The file name should end in SUFFIX.
665Do not expand PREFIX; a non-absolute PREFIX is relative to the Emacs
666working directory.
665 667
666Signal an error if the file could not be created. 668Signal an error if the file could not be created.
667 669
668This function does not grok magic file names. */) 670This function does not grok magic file names. */)
669 (Lisp_Object prefix, Lisp_Object dir_flag, Lisp_Object suffix) 671 (Lisp_Object prefix, Lisp_Object dir_flag, Lisp_Object suffix)
670{ 672{
671 bool make_temp_name = EQ (dir_flag, make_number (0)); 673 CHECK_STRING (prefix);
672 CHECK_STRING (suffix); 674 CHECK_STRING (suffix);
673 if (!make_temp_name)
674 prefix = Fexpand_file_name (prefix, Vtemporary_file_directory);
675
676 Lisp_Object encoded_prefix = ENCODE_FILE (prefix); 675 Lisp_Object encoded_prefix = ENCODE_FILE (prefix);
677 Lisp_Object encoded_suffix = ENCODE_FILE (suffix); 676 Lisp_Object encoded_suffix = ENCODE_FILE (suffix);
678 ptrdiff_t prefix_len = SBYTES (encoded_prefix); 677 ptrdiff_t prefix_len = SBYTES (encoded_prefix);
@@ -686,7 +685,7 @@ This function does not grok magic file names. */)
686 memset (data + prefix_len, 'X', nX); 685 memset (data + prefix_len, 'X', nX);
687 memcpy (data + prefix_len + nX, SSDATA (encoded_suffix), suffix_len); 686 memcpy (data + prefix_len + nX, SSDATA (encoded_suffix), suffix_len);
688 int kind = (NILP (dir_flag) ? GT_FILE 687 int kind = (NILP (dir_flag) ? GT_FILE
689 : make_temp_name ? GT_NOCREATE 688 : EQ (dir_flag, make_number (0)) ? GT_NOCREATE
690 : GT_DIR); 689 : GT_DIR);
691 int fd = gen_tempname (data, suffix_len, O_BINARY | O_CLOEXEC, kind); 690 int fd = gen_tempname (data, suffix_len, O_BINARY | O_CLOEXEC, kind);
692 if (fd < 0 || (NILP (dir_flag) && emacs_close (fd) != 0)) 691 if (fd < 0 || (NILP (dir_flag) && emacs_close (fd) != 0))