diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2020-06-19 15:12:31 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2020-06-19 15:12:31 +0200 |
commit | 3e7499c8389b8e8900320914fe496ae2780a453e (patch) | |
tree | 7ac6ce3a5255e703a8f6b10b216df873d5953125 /lisp/net/tramp.el | |
parent | 1e3b0f2d95a6b822e06586564bcb5204a1f78b15 (diff) | |
download | emacs-3e7499c8389b8e8900320914fe496ae2780a453e.tar.gz emacs-3e7499c8389b8e8900320914fe496ae2780a453e.tar.bz2 emacs-3e7499c8389b8e8900320914fe496ae2780a453e.zip |
Fix various problems in Tramp
* lisp/net/tramp-compat.el (tramp-temp-name-prefix): Declare.
(tramp-compat-make-temp-name):
* lisp/net/tramp.el (tramp-make-tramp-temp-name): New defuns.
* lisp/net/tramp.el (tramp-make-tramp-temp-file):
* lisp/net/tramp-sh.el (tramp-find-inline-encoding)
(tramp-maybe-open-connection, tramp-get-remote-touch)
(tramp-get-remote-chmod-h):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory): Use them.
* lisp/net/tramp-sh.el (tramp-do-file-attributes-with-stat):
Simplify shell command. Suppress errors (interpret as nil).
(tramp-sh-handle-make-process): Do not visit with
`insert-file-contents'. Delete tmp file only if exists.
(tramp-send-command-and-read): Suppress `signal-hook-function'
when reading expression.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r-- | lisp/net/tramp.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9314c437d29..1b50a6cf25b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4726,18 +4726,21 @@ This handles also chrooted environments, which are not regarded as local." (tramp-error vec 'file-error "Directory %s not accessible" dir)) dir))) +(defun tramp-make-tramp-temp-name (vec) + "Generate a temporary file name on the remote host identified by VEC." + (make-temp-name + (expand-file-name tramp-temp-name-prefix (tramp-get-remote-tmpdir vec)))) + (defun tramp-make-tramp-temp-file (vec) "Create a temporary file on the remote host identified by VEC. Return the local name of the temporary file." - (let ((prefix (expand-file-name - tramp-temp-name-prefix (tramp-get-remote-tmpdir vec))) - result) + (let (result) (while (not result) ;; `make-temp-file' would be the natural choice for ;; implementation. But it calls `write-region' internally, ;; which also needs a temporary file - we would end in an ;; infinite loop. - (setq result (make-temp-name prefix)) + (setq result (tramp-make-tramp-temp-name vec)) (if (file-exists-p result) (setq result nil) ;; This creates the file by side effect. |