From d3cefd1358e021cc4d510afb18916b067e6b1419 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 5 Dec 2012 19:10:00 +0200 Subject: [PATCH] Fix one part of bug #13079 with temporary files in call-process-region. src/callproc.c (Fcall_process_region) [!HAVE_MKSTEMP]: If mktemp fails, signal an error instead of continuing with an empty string. --- src/ChangeLog | 6 ++++++ src/callproc.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 6d2cd720672..e71667f7dcf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-12-05 Eli Zaretskii + + * callproc.c (Fcall_process_region) [!HAVE_MKSTEMP]: If mktemp + fails, signal an error instead of continuing with an empty + string. (Bug#13079) + 2012-12-04 Eli Zaretskii * fileio.c (file_name_as_directory, directory_file_name) [DOS_NT]: diff --git a/src/callproc.c b/src/callproc.c index c236f22fc86..ce3b11af696 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -977,7 +977,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); -- 2.39.5