changeset 105634:75fb0870b7e0

* net/tramp-smb.el (tramp-smb-version): New defvar. (tramp-smb-maybe-open-connection): Use it, in order to avoid repeated checks.
author Michael Albinus <michael.albinus@gmx.de>
date Fri, 16 Oct 2009 14:36:02 +0000
parents 411fa34ae614
children 9de33676e0ac
files lisp/net/tramp-smb.el
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/tramp-smb.el	Fri Oct 16 06:50:00 2009 +0000
+++ b/lisp/net/tramp-smb.el	Fri Oct 16 14:36:02 2009 +0000
@@ -61,6 +61,9 @@
   :group 'tramp
   :type 'string)
 
+(defvar tramp-smb-version nil
+  "*Version string of the SMB client.")
+
 (defconst tramp-smb-prompt "^smb: .+> \\|^\\s-+Server\\s-+Comment$"
   "Regexp used as prompt in smbclient.")
 
@@ -1209,13 +1212,15 @@
 	 "Cannot find command %s in %s" tramp-smb-program exec-path))
 
       (let* ((default-directory (tramp-compat-temporary-file-directory))
-	     (smbclient-version
-	      (shell-command-to-string (concat tramp-smb-program " -V"))))
-	(tramp-message vec 6 (concat tramp-smb-program " -V"))
-	(tramp-message vec 6 "\n%s" smbclient-version)
-	(if (string-match "[ \t\n\r]+\\'" smbclient-version)
-	    (setq smbclient-version
-		  (replace-match "" nil nil smbclient-version)))
+	     (smbclient-version tramp-smb-version))
+	(unless smbclient-version
+	  (setq smbclient-version
+		(shell-command-to-string (concat tramp-smb-program " -V")))
+	  (tramp-message vec 6 (concat tramp-smb-program " -V"))
+	  (tramp-message vec 6 "\n%s" smbclient-version)
+	  (if (string-match "[ \t\n\r]+\\'" smbclient-version)
+	      (setq smbclient-version
+		    (replace-match "" nil nil smbclient-version))))
 	(unless
 	    (string-equal
 	     smbclient-version
@@ -1223,8 +1228,9 @@
 	      vec "smbclient-version" smbclient-version))
 	  (tramp-flush-directory-property vec "")
 	  (tramp-flush-connection-property vec))
-	(tramp-set-connection-property
-	 vec "smbclient-version" smbclient-version)))
+	(setq tramp-smb-version
+	      (tramp-set-connection-property
+	       vec "smbclient-version" smbclient-version))))
 
     ;; If too much time has passed since last command was sent, look
     ;; whether there has been an error message; maybe due to