Commit 1bd012ce authored by Naofumi Yasufuku's avatar Naofumi Yasufuku Committed by Michael Albinus
Browse files

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
parent e77bd6e8
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment