From: Naofumi Yasufuku Date: Sun, 18 Jul 2021 14:57:53 +0000 (+0200) Subject: Make remote file locks more robust. (Bug#49621) X-Git-Tag: emacs-28.0.90~1821 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1bd012ce439382e1da49e711ac74ac0a07d05075;p=emacs.git Make remote file locks more robust. (Bug#49621) * lisp/net/tramp-sh.el (tramp-sh-handle-write-region): Make file locks more robust. (Bug#49621) Copyright-paperwork-exempt: yes --- diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index e6bd42a83ae..8b4c78fe65b 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3249,7 +3249,7 @@ implementation will be used." (format "File %s exists; overwrite anyway? " filename))))) (tramp-error v 'file-already-exists filename)) - (let (file-locked + (let ((file-locked (eq (file-locked-p lockname) t)) (uid (or (tramp-compat-file-attribute-user-id (file-attributes filename 'integer)) (tramp-get-remote-uid v 'integer))) @@ -3260,7 +3260,7 @@ implementation will be used." ;; Lock file. (when (and (not (auto-save-file-name-p (file-name-nondirectory filename))) (file-remote-p lockname) - (not (eq (file-locked-p lockname) t))) + (not file-locked)) (setq file-locked t) ;; `lock-file' exists since Emacs 28.1. (tramp-compat-funcall 'lock-file lockname)) @@ -3481,7 +3481,7 @@ implementation will be used." (tramp-set-file-uid-gid filename uid gid)) ;; Unlock file. - (when (and file-locked (eq (file-locked-p lockname) t)) + (when file-locked ;; `unlock-file' exists since Emacs 28.1. (tramp-compat-funcall 'unlock-file lockname))