about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-07-19 14:26:14 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-07-19 14:26:14 +0000
commitd6d4a3abfc84f0940e663cd69537789a039a7056 (patch)
tree5f5f40ae248c17c34fccbcadef85dddd4136b781 /Src/exec.c
parent1f6786ef7ae24ff858f52c6d4ac2bc23d529c0c1 (diff)
downloadzsh-3.1.6-test-2.tar.gz
zsh-3.1.6-test-2.tar.xz
zsh-3.1.6-test-2.zip
zsh-3.1.6-test-2 zsh-3.1.6-test-2
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 9c7a1ceb5..dc281675f 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3144,9 +3144,24 @@ static int
 cancd2(char *s)
 {
     struct stat buf;
-    char *us = unmeta(s);
+    char *us, *us2 = NULL;
 
+    /*
+     * If CHASEDOTS and CHASELINKS are not set, we want to rationalize the
+     * path by removing foo/.. combinations in the logical rather than
+     * the physical path.  If either is set, we test the physical path.
+     */
+    if (!isset(CHASEDOTS) && !isset(CHASELINKS)) {
+	if (*s != '/')
+	    us = tricat(pwd[1] ? pwd : "", "/", s);
+	else
+	    us = ztrdup(s);
+	fixdir(us2 = us);
+    } else
+	us = unmeta(s);
     return !(access(us, X_OK) || stat(us, &buf) || !S_ISDIR(buf.st_mode));
+    if (us2)
+	free(us2);
 }
 
 /**/