From d3f1682ae9f95ee912d9bc5a2ab5c58659abf065 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 22 Dec 2022 19:39:59 +0100 Subject: Handle make-directory return values in file name handlers * lisp/net/ange-ftp.el (ange-ftp-make-directory): Handle return values. * lisp/net/tramp.el (tramp-skeleton-make-directory): New defmacro. Handle also return values. * lisp/net/tramp-adb.el (tramp-adb-handle-make-directory): * lisp/net/tramp-crypt.el (tramp-crypt-handle-make-directory): * lisp/net/tramp-fuse.el (tramp-fuse-handle-make-directory): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-make-directory): * lisp/net/tramp-sh.el (tramp-sh-handle-make-directory): * lisp/net/tramp-smb.el (tramp-smb-handle-make-directory): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-directory): Use it. * test/lisp/net/tramp-tests.el (tramp-test13-make-directory): Handle return values. --- lisp/net/tramp-sudoedit.el | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'lisp/net/tramp-sudoedit.el') diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index fcc27dd8343..8774367cefe 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -626,18 +626,9 @@ the result will be a local, non-Tramp, file name." (defun tramp-sudoedit-handle-make-directory (dir &optional parents) "Like `make-directory' for Tramp files." - (setq dir (expand-file-name dir)) - (with-parsed-tramp-file-name dir nil - (when (and (null parents) (file-exists-p dir)) - (tramp-error v 'file-already-exists "Directory already exists %s" dir)) - ;; When PARENTS is non-nil, DIR could be a chain of non-existent - ;; directories a/b/c/... Instead of checking, we simply flush the - ;; whole cache. - (tramp-flush-directory-properties - v (if parents "/" (file-name-directory localname))) + (tramp-skeleton-make-directory dir parents (unless (tramp-sudoedit-send-command - v (if parents '("mkdir" "-p") "mkdir") - "-m" (format "%#o" (default-file-modes)) + v "mkdir" "-m" (format "%#o" (default-file-modes)) (tramp-compat-file-name-unquote localname)) (tramp-error v 'file-error "Couldn't make directory %s" dir)))) -- cgit v1.2.1