* mime-play.el (mime-activate-mailcap-method): Check the existance
authorueno <ueno>
Fri, 2 May 2003 02:30:01 +0000 (02:30 +0000)
committerueno <ueno>
Fri, 2 May 2003 02:30:01 +0000 (02:30 +0000)
of the temporary file.
[cf. <Wanderlust:11835>]

ChangeLog
mime-play.el

index 1a7b83e..ed75ec9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-02  Daiki Ueno  <ueno@unixuser.org>
+
+       * mime-play.el (mime-activate-mailcap-method): Check the existance
+       of the temporary file.
+       [cf. <Wanderlust:11835>]
+
 2003-04-05  Yoichi NAKAYAMA  <yoichi@geiin.org>
 
        * mime-view.el (mime-preview-toggle-display): Use boundary with
index a5cbe3e..ecbca96 100644 (file)
@@ -139,7 +139,20 @@ specified, play as it.  Default MODE is \"play\"."
              (expand-file-name name temporary-file-directory)
            (make-temp-name
             (expand-file-name "EMI" temporary-file-directory))))
-    (mime-write-entity-content entity name)
+    (if (and (not (featurep 'xemacs))
+            (>= emacs-major-version 21))
+       ;; For security reason, assert the 7th argument of
+       ;; `write-region' to be 'excl to guarantee that the file is
+       ;; created atomically.  Unfortunately, this feature is not yet
+       ;; supported in Emacs 20 or XEmacs.
+       (let ((coding-system-for-write 'binary)
+             jka-compr-compression-info-list jam-zcat-filename-list)
+         (write-region (mime-entity-content entity) nil name
+                       nil nil nil 'excl))
+      (if (file-exists-p name)
+         (signal 'file-already-exists
+                 (list "Failed to create temporary file" name))
+       (mime-write-entity-content entity name)))
     (message "External method is starting...")
     (let ((process
           (let ((command