summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-12 11:52:58 +0100
committerLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-12 11:52:58 +0100
commit3431e82d16af3d5130f0218efd5fafaa797ed28a (patch)
tree32ab731858bc1d6dfe714fce18f7eae292cc4415 /lisp/files.el
parent14efb831885fcdefb199e2ca8d28e73e01f55916 (diff)
downloademacs-3431e82d16af3d5130f0218efd5fafaa797ed28a.tar.gz
emacs-3431e82d16af3d5130f0218efd5fafaa797ed28a.tar.bz2
emacs-3431e82d16af3d5130f0218efd5fafaa797ed28a.zip
Ignore directory symlinks in directory-files-recursively
* files.el (directory-files-recursively): Don't follow symlinks to other directories.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 568c1bb58b1..40972d48b94 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -772,15 +772,15 @@ If INCLUDE-DIRECTORIES, also include directories that have matching names."
'string<))
(unless (member file '("./" "../"))
(if (= (aref file (1- (length file))) ?/)
- (progn
- (setq result (nconc result (directory-files-recursively
- (expand-file-name file dir)
- match include-directories)))
+ (let ((path (expand-file-name file 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)))))
- (setq result (nconc result (list
- (expand-file-name file dir))))))
+ (setq result (nconc result (list path)))))
(when (string-match match file)
(push (expand-file-name file dir) files)))))
(nconc result (nreverse files))))