]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/net/tramp.el (tramp-handle-file-regular-p): Improve error handling.
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 18 Nov 2019 14:33:21 +0000 (15:33 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 18 Nov 2019 14:33:21 +0000 (15:33 +0100)
lisp/net/tramp.el

index 99c93eaa5731d0337ebb444e8139808911e61581..cb40c71cfebff6acf798d452c06d70b096064b6b 100644 (file)
@@ -3306,9 +3306,13 @@ User is always nil."
 (defun tramp-handle-file-regular-p (filename)
   "Like `file-regular-p' for Tramp files."
   (and (file-exists-p filename)
-       (eq ?-
-          (aref (tramp-compat-file-attribute-modes (file-attributes filename))
-                0))))
+       ;; Sometimes, `file-attributes' does not return a proper value
+       ;; even if `file-exists-p' does.
+       (ignore-errors
+        (eq ?-
+            (aref
+             (tramp-compat-file-attribute-modes (file-attributes filename))
+             0)))))
 
 (defun tramp-handle-file-remote-p (filename &optional identification connected)
   "Like `file-remote-p' for Tramp files."