about summary refs log tree commit diff
path: root/Src/Zle/computil.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-07-26 14:00:46 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-07-26 14:00:46 +0000
commit278a892888352f717b72dc1af06105cdfcbe63fe (patch)
treef062b0f743807f274c44e45f9d6742f9d6b93870 /Src/Zle/computil.c
parentefa5e34c6cc67184b6d866921c6ae8d24ebff92d (diff)
downloadzsh-278a892888352f717b72dc1af06105cdfcbe63fe.tar.gz
zsh-278a892888352f717b72dc1af06105cdfcbe63fe.tar.xz
zsh-278a892888352f717b72dc1af06105cdfcbe63fe.zip
28102: use lstat() when checking ignore-parents
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r--Src/Zle/computil.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 32dd401b3..7c5bc2181 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -4653,6 +4653,15 @@ cf_pats(int dirs, int noopt, LinkList names, char **accept, char *skipped,
 			 names, skipped, sdirs, fake);
 }
 
+/*
+ * This function looks at device/inode pairs to determine if
+ * a file is one we should ignore because of its relationship
+ * to the current or parent directory.
+ *
+ * We don't follow symbolic links here, because typically
+ * a user will not want an explicit link to the current or parent
+ * directory ignored.
+ */
 static void
 cf_ignore(char **names, LinkList ign, char *style, char *path)
 {
@@ -4661,14 +4670,14 @@ cf_ignore(char **names, LinkList ign, char *style, char *path)
     char *n, *c, *e;
 
     tpar = !!strstr(style, "parent");
-    if ((tpwd = !!strstr(style, "pwd")) && stat(pwd, &est))
+    if ((tpwd = !!strstr(style, "pwd")) && lstat(pwd, &est))
 	tpwd = 0;
 
     if (!tpar && !tpwd)
 	return;
 
     for (; (n = *names); names++) {
-	if (!ztat(n, &nst, 0) && S_ISDIR(nst.st_mode)) {
+	if (!ztat(n, &nst, 1) && S_ISDIR(nst.st_mode)) {
 	    if (tpwd && nst.st_dev == est.st_dev && nst.st_ino == est.st_ino) {
 		addlinknode(ign, quotestring(n, NULL, QT_BACKSLASH));
 		continue;
@@ -4684,7 +4693,7 @@ cf_ignore(char **names, LinkList ign, char *style, char *path)
 		    }
 		}
 		if (found || ((e = strrchr(c, '/')) && e > c + pl &&
-			      !ztat(c, &st, 0) && st.st_dev == nst.st_dev &&
+			      !ztat(c, &st, 1) && st.st_dev == nst.st_dev &&
 			      st.st_ino == nst.st_ino))
 		    addlinknode(ign, quotestring(n, NULL, QT_BACKSLASH));
 	    }