From 79d2d2796a1f902a5f14edec9b300c053923c230 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 19 Mar 2005 13:30:10 +0000 Subject: [PATCH] (backup-buffer): If the file's directory is not writable, use copy instead of move to backup the file. --- lisp/ChangeLog | 5 +++++ lisp/files.el | 1 + 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be934154ad6..9d75a25f9e9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2005-03-19 JUAN-LEON Lahoz Garcia + + * files.el (backup-buffer): If the file's directory is not + writable, use copy instead of move to backup the file. + 2005-03-19 Eli Zaretskii * obsolete/keyswap.el: Moved to obsolete/ from term/. diff --git a/lisp/files.el b/lisp/files.el index ebd4d469f5c..68a1d52a2df 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2687,6 +2687,7 @@ BACKUPNAME is the backup file name, which is the old file renamed." backup-by-copying ;; Don't rename a suid or sgid file. (and modes (< 0 (logand modes #o6000))) + (not (file-writable-p (file-name-directory real-file-name))) (and backup-by-copying-when-linked (> (file-nlinks real-file-name) 1)) (and (or backup-by-copying-when-mismatch -- 2.39.2