aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert <[email protected]>2011-12-29 13:08:18 -0800
committerPaul Eggert <[email protected]>2011-12-29 13:08:18 -0800
commit6bb72cbd8b784aebbc8212dfc28bbfcfbb4b8867 (patch)
tree63ea14005c9f70fceeee40d697c3d3ee50e1aed0 /lisp
parentb9110d6a11deb9b1035da53812473f792891ad34 (diff)
* files.el (move-file-to-trash): Preserve default file modes on error.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/files.el14
2 files changed, 12 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 37286d0780..d1f00198ca 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2011-12-29 Paul Eggert <[email protected]>
+
+ * files.el (move-file-to-trash): Preserve default file modes on error.
+
2011-12-29 Michael Albinus <[email protected]>
* net/tramp-sh.el (tramp-find-shell): Set "remote-shell" property
diff --git a/lisp/files.el b/lisp/files.el
index 0f7386511f..4cb033617c 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6457,12 +6457,14 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
;; Ensure that the trash directory exists; otherwise, create it.
(let ((saved-default-file-modes (default-file-modes)))
- (set-default-file-modes ?\700)
- (unless (file-exists-p trash-files-dir)
- (make-directory trash-files-dir t))
- (unless (file-exists-p trash-info-dir)
- (make-directory trash-info-dir t))
- (set-default-file-modes saved-default-file-modes))
+ (unwind-protect
+ (progn
+ (set-default-file-modes #o700)
+ (unless (file-exists-p trash-files-dir)
+ (make-directory trash-files-dir t))
+ (unless (file-exists-p trash-info-dir)
+ (make-directory trash-info-dir t)))
+ (set-default-file-modes saved-default-file-modes)))
;; Try to move to trash with .trashinfo undo information
(save-excursion