diff options
Diffstat (limited to 'src/callproc.c')
-rw-r--r-- | src/callproc.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/callproc.c b/src/callproc.c index ea79da7ff5a..cb11ee0cc53 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1016,8 +1016,26 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r { USE_SAFE_ALLOCA; Lisp_Object pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); - Lisp_Object encoded_tem = ENCODE_FILE (pattern); - char *tempfile = SAFE_ALLOCA (SBYTES (encoded_tem) + 1); + Lisp_Object encoded_tem; + char *tempfile; + +#ifdef WINDOWSNT + /* Cannot use the result of Fexpand_file_name, because it + downcases the XXXXXX part of the pattern, and mktemp then + doesn't recognize it. */ + if (!NILP (Vw32_downcase_file_names)) + { + Lisp_Object dirname = Ffile_name_directory (pattern); + + if (NILP (dirname)) + pattern = Vtemp_file_name_pattern; + else + pattern = concat2 (dirname, Vtemp_file_name_pattern); + } +#endif + + encoded_tem = ENCODE_FILE (pattern); + tempfile = SAFE_ALLOCA (SBYTES (encoded_tem) + 1); memcpy (tempfile, SDATA (encoded_tem), SBYTES (encoded_tem) + 1); coding_systems = Qt; |