*** files.el Fri Aug 24 07:28:20 2007 --- files.el Fri Aug 24 11:04:42 2007 *************** *** 3172,3198 **** (file-error nil)))))) (defun backup-buffer-copy (from-name to-name modes) ! (let ((umask (default-file-modes)) ! (dir (or (file-name-directory to-name) ! default-directory))) (unwind-protect (progn ;; Create temp files with strict access rights. It's easy to ;; 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)) ;; Reset the umask. (set-default-file-modes umask))) (and modes --- 3172,3200 ---- (file-error nil)))))) (defun backup-buffer-copy (from-name to-name modes) ! (let ((umask (default-file-modes))) (unwind-protect (progn ;; Create temp files with strict access rights. It's easy to ;; loosen them later, whereas it's impossible to close the ;; time-window of loose permissions otherwise. (set-default-file-modes ?\700) ! (when (condition-case nil ! ;; Try to overwrite old backup first. ! (copy-file from-name to-name t t) ! (file-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