From: Paul Eggert Date: Sat, 7 Jan 2012 19:58:55 +0000 (-0800) Subject: Undo patch for bug#10403; still being reviewed. X-Git-Tag: emacs-pretest-24.0.93~97^2~54 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cd0cf8aa185960bfa65be999aea2d8f061d0b055;p=emacs.git Undo patch for bug#10403; still being reviewed. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 64416288c6c..b4bb7352fcb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,5 @@ 2012-01-07 Paul Eggert - * epg.el (epg--make-temp-file): Avoid permission race conditions - when creating temporary directories and files on older Emacs. - * files.el (move-file-to-trash): Preserve default file modes on error. (Bug#10401) diff --git a/lisp/epg.el b/lisp/epg.el index 4da06cd9933..3505e183c1f 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -1951,16 +1951,14 @@ The returned file name (created by appending some random characters at the end of PREFIX, and expanding against `temporary-file-directory' if necessary), is guaranteed to point to a newly created empty file. You can then use `write-region' to write new data into the file." - (let (tempdir tempfile orig-modes) + (let (tempdir tempfile) (setq prefix (expand-file-name prefix (if (featurep 'xemacs) (temp-directory) temporary-file-directory))) - (setq orig-modes (default-file-modes)) (unwind-protect (let (file) ;; First, create a temporary directory. - (set-default-file-modes #o700) (while (condition-case () (progn (setq tempdir (make-temp-name @@ -1971,12 +1969,14 @@ You can then use `write-region' to write new data into the file." (make-directory tempdir)) ;; let's try again. (file-already-exists t))) + (set-file-modes tempdir 448) ;; Second, create a temporary file in the tempdir. ;; There *is* a race condition between `make-temp-name' ;; and `write-region', but we don't care it since we are ;; in a private directory now. (setq tempfile (make-temp-name (concat tempdir "/EMU"))) (write-region "" nil tempfile nil 'silent) + (set-file-modes tempfile 384) ;; Finally, make a hard-link from the tempfile. (while (condition-case () (progn @@ -1986,7 +1986,6 @@ You can then use `write-region' to write new data into the file." ;; let's try again. (file-already-exists t))) file) - (set-default-file-modes orig-modes) ;; Cleanup the tempfile. (and tempfile (file-exists-p tempfile)