changeset 105493:c8d4e5f3f0c8

(tramp-compat-process-running-p): Check that the comm attribute is present before calling regexp-quote.
author Sam Steingold <sds@gnu.org>
date Tue, 06 Oct 2009 19:52:15 +0000
parents a712582124ee
children 6104e7688824
files lisp/ChangeLog lisp/net/tramp-compat.el
diffstat 2 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Oct 06 18:32:07 2009 +0000
+++ b/lisp/ChangeLog	Tue Oct 06 19:52:15 2009 +0000
@@ -1,3 +1,8 @@
+2009-10-06  Sam Steingold  <sds@gnu.org>
+
+	* net/tramp-compat.el (tramp-compat-process-running-p): Check that
+	the comm attribute is present before calling regexp-quote.
+
 2009-10-06  Juanma Barranquero  <lekktu@gmail.com>
 
 	* play/animate.el (animate-string): For good effect, make sure
--- a/lisp/net/tramp-compat.el	Tue Oct 06 18:32:07 2009 +0000
+++ b/lisp/net/tramp-compat.el	Tue Oct 06 19:52:15 2009 +0000
@@ -312,15 +312,15 @@
 	(dolist (pid (funcall (symbol-function 'list-system-processes)) result)
 	  (let ((attributes
 		 (funcall (symbol-function 'process-attributes) pid)))
-	    (when
-		(and (string-equal
-		      (cdr (assoc 'user attributes)) (user-login-name))
-		     ;; The returned command name could be truncated
-		     ;; to 15 characters.  Therefore, we cannot check
-		     ;; for `string-equal'.
-		     (string-match
-		      (concat "^" (regexp-quote (cdr (assoc 'comm attributes))))
-		      process-name))
+	    (when (and (string-equal
+                        (cdr (assoc 'user attributes)) (user-login-name))
+                       (let ((comm (cdr (assoc 'comm attributes))))
+                         ;; The returned command name could be truncated
+                         ;; to 15 characters.  Therefore, we cannot check
+                         ;; for `string-equal'.
+                         (and comm (string-match
+                                    (concat "^" (regexp-quote comm))
+                                    process-name))))
 	      (setq result t))))))
 
      ;; Fallback, if there is no Lisp support yet.