From fffba733ad57fc244414b9cbd0a240dd65f188b9 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 22 Jun 2009 21:08:29 +0000 Subject: [PATCH] * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add handler for `dired-uncache'. (tramp-smb-handle-file-local-copy): Cleanup in case of error. --- lisp/net/tramp-smb.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 41f4c25318a..26edcf8b1c8 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -139,7 +139,7 @@ See `tramp-actions-before-shell' for more info.") (directory-files-and-attributes . tramp-smb-handle-directory-files-and-attributes) (dired-call-process . ignore) (dired-compress-file . ignore) - ;; `dired-uncache' performed by default handler + (dired-uncache . tramp-handle-dired-uncache) ;; `expand-file-name' not necessary because we cannot expand "~/" (file-accessible-directory-p . tramp-smb-handle-file-directory-p) (file-attributes . tramp-smb-handle-file-attributes) @@ -375,16 +375,18 @@ PRESERVE-UID-GID is completely ignored." (defun tramp-smb-handle-file-local-copy (filename) "Like `file-local-copy' for Tramp files." (with-parsed-tramp-file-name filename nil + (unless (file-exists-p filename) + (tramp-error + v 'file-error + "Cannot make local copy of non-existing file `%s'" filename)) (let ((file (tramp-smb-get-localname localname t)) (tmpfile (tramp-compat-make-temp-file filename))) - (unless (file-exists-p filename) - (tramp-error - v 'file-error - "Cannot make local copy of non-existing file `%s'" filename)) (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile) (if (tramp-smb-send-command v (format "get \"%s\" %s" file tmpfile)) (tramp-message v 4 "Fetching %s to tmp file %s...done" filename tmpfile) + ;; Oops, an error. We shall cleanup. + (delete-file tmpfile) (tramp-error v 'file-error "Cannot make local copy of file `%s'" filename)) -- 2.39.2