From bb4a52db9ff6752f44849b7e411dd5d783c12d3f Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Tue, 17 Feb 2009 14:27:28 +0000 Subject: [PATCH] (make-directory): Stop recursing if parent is self. (Bug#2309) --- lisp/files.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/files.el b/lisp/files.el index fd4d05b6577..da8db21274b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4541,7 +4541,12 @@ this happens by default." (make-directory-internal dir) (let ((dir (directory-file-name (expand-file-name dir))) create-list) - (while (not (file-exists-p dir)) + (while (and (not (file-exists-p dir)) + ;; If directory is its own parent, then we can't + ;; keep looping forever + (not (equal dir + (directory-file-name + (file-name-directory dir))))) (setq create-list (cons dir create-list) dir (directory-file-name (file-name-directory dir)))) (while create-list -- 2.39.5