Fix one part of bug #13079 with temporary files in call-process-region.
authorEli Zaretskii <eliz@gnu.org>
Wed, 5 Dec 2012 17:10:00 +0000 (19:10 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 5 Dec 2012 17:10:00 +0000 (19:10 +0200)
 src/callproc.c (Fcall_process_region) [!HAVE_MKSTEMP]: If mktemp
 fails, signal an error instead of continuing with an empty
 string.

src/ChangeLog
src/callproc.c

index 6d2cd72..e71667f 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * 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  <eliz@gnu.org>
 
        * fileio.c (file_name_as_directory, directory_file_name) [DOS_NT]:
index c236f22..ce3b11a 100644 (file)
@@ -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);