summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-13 15:50:28 +0100
committerLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-13 15:50:28 +0100
commit3e8e9713565c3cfacc33763e789514d5960c59e2 (patch)
tree935e7b79374b2b2d388cd0941aa12cb095401d28 /lisp/files.el
parentc13baa10d55ec863d3ceaea48c6b2959ece98198 (diff)
downloademacs-3e8e9713565c3cfacc33763e789514d5960c59e2.tar.gz
emacs-3e8e9713565c3cfacc33763e789514d5960c59e2.tar.bz2
emacs-3e8e9713565c3cfacc33763e789514d5960c59e2.zip
directory-files-recursively symlink fix
* files.el (directory-files-recursively): Really check whether files are symlinks.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 40972d48b94..2ab740d4a7f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -772,14 +772,14 @@ If INCLUDE-DIRECTORIES, also include directories that have matching names."
'string<))
(unless (member file '("./" "../"))
(if (= (aref file (1- (length file))) ?/)
- (let ((path (expand-file-name file dir)))
+ (let* ((leaf (substring file 0 (1- (length file))))
+ (path (expand-file-name leaf dir)))
;; Don't follow symlinks to other directories.
(unless (file-symlink-p path)
(setq result (nconc result (directory-files-recursively
path match include-directories))))
(when (and include-directories
- (string-match match
- (substring file 0 (1- (length file)))))
+ (string-match match leaf))
(setq result (nconc result (list path)))))
(when (string-match match file)
(push (expand-file-name file dir) files)))))