summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-sudoedit.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-12-22 19:39:59 +0100
committerMichael Albinus <michael.albinus@gmx.de>2022-12-22 19:39:59 +0100
commitd3f1682ae9f95ee912d9bc5a2ab5c58659abf065 (patch)
tree1b656591c1ce33753387d5112917e5fecb86d4d1 /lisp/net/tramp-sudoedit.el
parentf681b76a7c43ff54f1aba276f09b8fa0e0dea578 (diff)
downloademacs-d3f1682ae9f95ee912d9bc5a2ab5c58659abf065.tar.gz
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.
Diffstat (limited to 'lisp/net/tramp-sudoedit.el')
-rw-r--r--lisp/net/tramp-sudoedit.el13
1 files changed, 2 insertions, 11 deletions
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))))