From: Michael Albinus Date: Sun, 3 Mar 2013 10:31:01 +0000 (+0100) Subject: * net/tramp-adb.el (tramp-adb-maybe-open-connection): Cache, X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~639 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9a0f9ec39af1433cf9ba180d47351afa0fb78b8e;p=emacs.git * net/tramp-adb.el (tramp-adb-maybe-open-connection): Cache, whether the "su" command is available on the device. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8b6ffeed01d..a19ebaf473f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-03-03 Michael Albinus + + * net/tramp-adb.el (tramp-adb-maybe-open-connection): Cache, + whether the "su" command is available on the device. + 2013-03-01 Michael Albinus * net/tramp-adb.el (tramp-adb-prompt): Extend regexp. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 910356fbb6c..2d683a4d3d2 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -1074,6 +1074,13 @@ connection if a previous connection has died for some reason." (host (tramp-file-name-host vec)) (user (tramp-file-name-user vec)) (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))) + + ;; Maybe we know already that "su" is not supported. We cannot + ;; use a connection property, because we have not checked yet + ;; whether it is still the same device. + (when (and user (not (tramp-get-file-property vec "" "su-command-p" t))) + (tramp-error vec 'file-error "Cannot switch to user `%s'" user)) + (unless (and p (processp p) (memq (process-status p) '(run open))) (save-match-data @@ -1133,7 +1140,9 @@ connection if a previous connection has died for some reason." (tramp-adb-send-command vec (format "su %s" user)) (unless (zerop (tramp-adb-command-exit-status vec nil)) (delete-process p) - (tramp-error vec 'file-error "Cannot switch to user %s" user))) + (tramp-set-file-property vec "" "su-command-p" nil) + (tramp-error + vec 'file-error "Cannot switch to user `%s'" user))) ;; Set "remote-path" connection property. This is needed ;; for eshell.