Mercurial > emacs
changeset 78703:7d09f83a1085
(backup-buffer-copy): Try to overwrite old backup first.
author | Martin Rudalics <rudalics@gmx.at> |
---|---|
date | Thu, 30 Aug 2007 08:15:37 +0000 |
parents | 725c01b32a71 |
children | c6b315312032 |
files | lisp/files.el |
diffstat | 1 files changed, 16 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/files.el Thu Aug 30 08:06:06 2007 +0000 +++ b/lisp/files.el Thu Aug 30 08:15:37 2007 +0000 @@ -3127,18 +3127,22 @@ ;; loosen them later, whereas it's impossible to close the ;; time-window of loose permissions otherwise. (set-default-file-modes ?\700) - (while (condition-case () - (progn - (and (file-exists-p to-name) - (delete-file to-name)) - (copy-file from-name to-name nil t) - nil) - (file-already-exists t)) - ;; The file was somehow created by someone else between - ;; `delete-file' and `copy-file', so let's try again. - ;; rms says "I think there is also a possible race - ;; condition for making backup files" (emacs-devel 20070821). - nil)) + (when (condition-case nil + ;; Try to overwrite old backup first. + (copy-file from-name to-name t t) + (error t)) + (while (condition-case nil + (progn + (when (file-exists-p to-name) + (delete-file to-name)) + (copy-file from-name to-name nil t) + nil) + (file-already-exists t)) + ;; The file was somehow created by someone else between + ;; `delete-file' and `copy-file', so let's try again. + ;; rms says "I think there is also a possible race + ;; condition for making backup files" (emacs-devel 20070821). + nil))) ;; Reset the umask. (set-default-file-modes umask))) (and modes