summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-sh.el
diff options
context:
space:
mode:
authorNaofumi Yasufuku <naofumi@yasufuku.dev>2021-07-18 16:57:53 +0200
committerMichael Albinus <michael.albinus@gmx.de>2021-07-18 16:57:53 +0200
commit1bd012ce439382e1da49e711ac74ac0a07d05075 (patch)
tree3cfcfe1d225e943601bf2a97f4dca8d84b13e35e /lisp/net/tramp-sh.el
parente77bd6e8bf0601029465f1af11bbef97ba2d1f49 (diff)
downloademacs-1bd012ce439382e1da49e711ac74ac0a07d05075.tar.gz
emacs-1bd012ce439382e1da49e711ac74ac0a07d05075.tar.bz2
emacs-1bd012ce439382e1da49e711ac74ac0a07d05075.zip
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
Diffstat (limited to 'lisp/net/tramp-sh.el')
-rw-r--r--lisp/net/tramp-sh.el6
1 files changed, 3 insertions, 3 deletions
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))