changeset 98178:b0fd32c6e590

(file-truename): Don't raise args-out-of-range error when filename has no separator on windows-nt. (Bug#982)
author Martin Rudalics <rudalics@gmx.at>
date Mon, 15 Sep 2008 09:23:14 +0000
parents d989cacb2b4e
children 30fd12f4f12b
files lisp/files.el
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Mon Sep 15 08:21:39 2008 +0000
+++ b/lisp/files.el	Mon Sep 15 09:23:14 2008 +0000
@@ -856,10 +856,14 @@
                   missing rest)
               (if longname
                   (setq filename longname)
-                ;; include the preceding directory separator in the missing
+                ;; Include the preceding directory separator in the missing
                 ;; part so subsequent recursion on the rest works.
                 (setq missing (concat "/" (file-name-nondirectory filename)))
-                (setq rest (substring filename 0 (* -1 (length missing))))
+		(let ((length (length missing)))
+		  (setq rest
+			(if (> length (length filename))
+			    ""
+			  (substring filename 0 (- length)))))
                 (setq filename (concat (file-truename rest) missing))))))
 	(setq done t)))