emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113605: Fix tempfile bug on platforms lacking mkost


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113605: Fix tempfile bug on platforms lacking mkostemp and mkstemp.
Date: Tue, 30 Jul 2013 21:44:52 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113605
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/14986
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2013-07-30 23:44:43 +0200
message:
  Fix tempfile bug on platforms lacking mkostemp and mkstemp.
  
  * callproc.c (create_temp_file) [! (HAVE_MKOSTEMP || HAVE_MKSTEMP)]:
  Do not assume that emacs_close (INT_MAX) is a no-op.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/callproc.c                 callproc.c-20091113204419-o5vbwnq5f7feedwu-248
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-07-30 13:40:46 +0000
+++ b/src/ChangeLog     2013-07-30 21:44:43 +0000
@@ -1,3 +1,9 @@
+2013-07-30  Paul Eggert  <address@hidden>
+
+       Fix tempfile bug on platforms lacking mkostemp and mkstemp (Bug#14986).
+       * callproc.c (create_temp_file) [! (HAVE_MKOSTEMP || HAVE_MKSTEMP)]:
+       Do not assume that emacs_close (INT_MAX) is a no-op.
+
 2013-07-30  Dmitry Antipov  <address@hidden>
 
        * xfaces.c (make_face_cache): For struct face_cache, prefer

=== modified file 'src/callproc.c'
--- a/src/callproc.c    2013-07-23 01:11:40 +0000
+++ b/src/callproc.c    2013-07-30 21:44:43 +0000
@@ -1018,13 +1018,14 @@
 #else
       errno = EEXIST;
       mktemp (tempfile);
-      /* INT_MAX denotes success, because close (INT_MAX) does nothing.  */
-      fd = *tempfile ? INT_MAX : -1;
+      fd = *tempfile ? 0 : -1;
 #endif
       if (fd < 0)
        report_file_error ("Failed to open temporary file using pattern",
                           pattern);
+#if defined HAVE_MKOSTEMP || defined HAVE_MKSTEMP
       emacs_close (fd);
+#endif
     }
 
     record_unwind_protect (delete_temp_file, filename_string);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]