aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2020-03-21 10:30:26 +0100
committerMichael Albinus2020-03-21 10:30:26 +0100
commit8158337cc254403fbae6fed3d80064400f62f48b (patch)
tree14ce35860390df58d60763d5c5b726800755f201 /lisp
parent0a22747c3f17da0e64cbb6d82aab3a14e716f0fd (diff)
downloademacs-8158337cc254403fbae6fed3d80064400f62f48b.tar.gz
emacs-8158337cc254403fbae6fed3d80064400f62f48b.zip
Fix Bug#40156 in Tramp
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region): Copy to temp file only if FILENAME exists. (Bug#40156) * test/lisp/net/tramp-tests.el (tramp-test10-write-region): Extend test.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/tramp-sh.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 7ac41d16c8b..06dca312275 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3306,7 +3306,8 @@ STDERR can also be a file name."
3306 3306
3307 ;; If `append' is non-nil, we copy the file locally, and let 3307 ;; If `append' is non-nil, we copy the file locally, and let
3308 ;; the native `write-region' implementation do the job. 3308 ;; the native `write-region' implementation do the job.
3309 (when append (copy-file filename tmpfile 'ok)) 3309 (when (and append (file-exists-p filename))
3310 (copy-file filename tmpfile 'ok))
3310 3311
3311 ;; We say `no-message' here because we don't want the 3312 ;; We say `no-message' here because we don't want the
3312 ;; visited file modtime data to be clobbered from the temp 3313 ;; visited file modtime data to be clobbered from the temp