about summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-13 09:37:31 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-13 09:37:31 +0000
commit2d69947427fac68c06ca9e659cf2ad5fbacaf19d (patch)
tree4ab35d32d769c65a676a87b0226babb29ac11a1e /Src/glob.c
parenteaa55b546134c5adf461f485d4ab388df2b6ea8b (diff)
downloadzsh-2d69947427fac68c06ca9e659cf2ad5fbacaf19d.tar.gz
zsh-2d69947427fac68c06ca9e659cf2ad5fbacaf19d.tar.xz
zsh-2d69947427fac68c06ca9e659cf2ad5fbacaf19d.zip
zsh-workers/10103
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/Src/glob.c b/Src/glob.c
index c457e97ac..5a4add319 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -479,11 +479,26 @@ scanner(Complist q)
 	    /* Not the last path section. Just add it to the path. */
 	    int oppos = pathpos;
 
-	    if (!errflag && !(q->closure && !strcmp(str, "."))) {
-		addpath(str);
-		if (!closure || !statfullpath("", NULL, 1))
-		    scanner((q->closure) ? q : q->next);
-		pathbuf[pathpos = oppos] = '\0';
+	    if (!errflag) {
+		int add = 1;
+
+		if (q->closure && *pathbuf) {
+		    if (!strcmp(str, "."))
+			add = 0;
+		    else if (!strcmp(str, "..")) {
+			struct stat sc, sr;
+
+			add = (stat("/", &sr) || stat(pathbuf, &sc) ||
+			       sr.st_ino != sc.st_ino ||
+			       sr.st_dev != sc.st_dev);
+		    }
+		}
+		if (add) {
+		    addpath(str);
+		    if (!closure || !statfullpath("", NULL, 1))
+			scanner((q->closure) ? q : q->next);
+		    pathbuf[pathpos = oppos] = '\0';
+		}
 	    }
 	} else
 	    insert(str, 0);