diff options
Diffstat (limited to 'lisp/net/tramp-sshfs.el')
-rw-r--r-- | lisp/net/tramp-sshfs.el | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index c5b84a6e4e4..a1007863453 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -222,11 +222,14 @@ arguments to pass to the OPERATION." (defun tramp-sshfs-handle-insert-file-contents (filename &optional visit beg end replace) "Like `insert-file-contents' for Tramp files." - (let ((result - (insert-file-contents - (tramp-fuse-local-file-name filename) visit beg end replace))) - (when visit (setq buffer-file-name filename)) - (cons (expand-file-name filename) (cdr result)))) + (setq filename (expand-file-name filename)) + (let (signal-hook-function result) + (unwind-protect + (setq result + (insert-file-contents + (tramp-fuse-local-file-name filename) visit beg end replace)) + (when visit (setq buffer-file-name filename)) + (cons filename (cdr result))))) (defun tramp-sshfs-handle-process-file (program &optional infile destination display &rest args) @@ -292,7 +295,7 @@ arguments to pass to the OPERATION." (or (eq mustbenew 'excl) (not (y-or-n-p - (format "File %s exists; overwrite anyway? " filename))))) + (format "File %s exists; overwrite anyway?" filename))))) (tramp-error v 'file-already-exists filename)) (let ((file-locked (eq (file-locked-p lockname) t))) @@ -317,7 +320,7 @@ arguments to pass to the OPERATION." ;; The end. (when (and (null noninteractive) - (or (eq visit t) (null visit) (stringp visit))) + (or (eq visit t) (string-or-null-p visit))) (tramp-message v 0 "Wrote %s" filename)) (run-hooks 'tramp-handle-write-region-hook)))) @@ -346,30 +349,31 @@ connection if a previous connection has died for some reason." (tramp-set-connection-property p "lock-pid" (truncate (time-to-seconds))) ;; Set connection-local variables. - (tramp-set-connection-local-variables vec) - - ;; Create directory. - (unless (file-directory-p (tramp-fuse-mount-point vec)) - (make-directory (tramp-fuse-mount-point vec) 'parents)) - - (unless - (or (tramp-fuse-mounted-p vec) - (with-temp-buffer - (zerop - (apply - #'tramp-call-process - vec tramp-sshfs-program nil t nil - (tramp-fuse-mount-spec vec) - (tramp-fuse-mount-point vec) - (tramp-expand-args - vec 'tramp-mount-args - ?p (or (tramp-file-name-port vec) ""))))) - (tramp-error - vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec)))) - - ;; Mark it as connected. - (tramp-set-connection-property - (tramp-get-connection-process vec) "connected" t))) + (tramp-set-connection-local-variables vec))) + + ;; Create directory. + (unless (file-directory-p (tramp-fuse-mount-point vec)) + (make-directory (tramp-fuse-mount-point vec) 'parents)) + + (unless + (or (tramp-fuse-mounted-p vec) + (with-temp-buffer + (zerop + (apply + #'tramp-call-process + vec tramp-sshfs-program nil t nil + (tramp-fuse-mount-spec vec) + (tramp-fuse-mount-point vec) + (tramp-expand-args + vec 'tramp-mount-args + ?p (or (tramp-file-name-port vec) "")))))) + (tramp-error + vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec))) + + ;; Mark it as connected. + (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) + (tramp-set-connection-property + (tramp-get-connection-process vec) "connected" t) ;; In `tramp-check-cached-permissions', the connection properties ;; "{uid,gid}-{integer,string}" are used. We set them to proper values. |