diff options
Diffstat (limited to 'src/callproc.c')
-rw-r--r-- | src/callproc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/callproc.c b/src/callproc.c index 2c3d31ba052..6153bc1b6c6 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -977,8 +977,9 @@ 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); - char *tempfile = SAFE_ALLOCA (SBYTES (pattern) + 1); - memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1); + Lisp_Object encoded_tem = ENCODE_FILE (pattern); + char *tempfile = SAFE_ALLOCA (SBYTES (encoded_tem) + 1); + memcpy (tempfile, SDATA (encoded_tem), SBYTES (encoded_tem) + 1); coding_systems = Qt; #ifdef HAVE_MKSTEMP @@ -995,7 +996,15 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r close (fd); } #else + errno = 0; mktemp (tempfile); + if (!*tempfile) + { + if (!errno) + errno = EEXIST; + report_file_error ("Failed to open temporary file using pattern", + Fcons (pattern, Qnil)); + } #endif filename_string = build_string (tempfile); |