(mm-display-external): Make temp file read-only.
authorReiner Steib <Reiner.Steib@gmx.de>
Sun, 13 Apr 2008 20:33:41 +0000 (20:33 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Sun, 13 Apr 2008 20:33:41 +0000 (20:33 +0000)
lisp/ChangeLog
lisp/mm-decode.el

index d86b598..ec1915c 100644 (file)
@@ -1,3 +1,7 @@
+2008-04-13  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * mm-decode.el (mm-display-external): Make temp file read-only.
+
 2008-04-11  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus.el: Bump version to 0.9.
index 46bf4b8..dde46be 100644 (file)
@@ -795,7 +795,7 @@ external if displayed external."
               (copiousoutput (assoc "copiousoutput" mime-info))
               file buffer)
          ;; We create a private sub-directory where we store our files.
-         (set-file-modes dir 448)
+         (set-file-modes dir #o700)
          (if filename
              (setq file (expand-file-name
                          (gnus-map-function mm-file-name-rewrite-functions
@@ -815,6 +815,10 @@ external if displayed external."
                                            nil suffix))))
          (let ((coding-system-for-write mm-binary-coding-system))
            (write-region (point-min) (point-max) file nil 'nomesg))
+         ;; The file is deleted after the viewer exists.  If the users edits
+         ;; the file, changes will be lost.  Set file to read-only to make it
+         ;; clear.
+         (set-file-modes file #o400)
          (message "Viewing with %s" method)
          (cond
           (needsterm