From: teranisi Date: Fri, 11 Feb 2005 09:05:16 +0000 (+0000) Subject: 2005-02-11 Hiroya Murata X-Git-Tag: wl-2_14-root~54 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9b66d514efe8c91c5b415479146f68d2c1bccf66;p=elisp%2Fwanderlust.git 2005-02-11 Hiroya Murata * elmo-maildir.el (elmo-maildir-move-file): Simplify. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index bbddd95..ae016ad 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,7 @@ +2005-02-11 Hiroya Murata + + * elmo-maildir.el (elmo-maildir-move-file): Simplify. + 2005-02-10 Yuuichi Teranishi * elmo-maildir.el (elmo-maildir-move-file): New function. diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 7e2fb56..044df74 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -417,23 +417,17 @@ file name for maildir directories." filename)) (defun elmo-maildir-move-file (src dst) - (or (and (fboundp 'make-symbolic-link) - ;; 1. If make-symbolic-link is defined, then assume the system has - ;; hardlinks and try add-link-to-file, then delete the original. - ;; This is safe on NFS. - (condition-case nil - (progn - (add-name-to-file src dst) - t) - (error)) - ;; It's ok if the delete-file fails; - ;; elmo-maildir-cleanup-temporal will catch it later. - (progn - (condition-case nil - (delete-file src) - (error)) - ;; Exit this function anyway. - t)) + (or (condition-case nil + (progn + ;; 1. Try add-link-to-file, then delete the original. + ;; This is safe on NFS. + (add-name-to-file src dst) + (ignore-errors + ;; It's ok if the delete-file fails; + ;; elmo-maildir-cleanup-temporal will catch it later. + (delete-file src)) + t) + (error)) ;; 2. Even on systems with hardlinks, some filesystems (like AFS) ;; might not support them, so fall back on rename-file. This is ;; our best shot at atomic when add-name-to-file fails.