about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-12-15 18:45:53 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-12-15 18:45:53 +0000
commitb9c19b15a6f01279ddcf32ca6fa51894a64a6c16 (patch)
tree6568b5657c7664335622544bc860006a0ec372c2 /Src/builtin.c
parent10c7dfab45e113d876659851fdee96f47e03b978 (diff)
downloadzsh-b9c19b15a6f01279ddcf32ca6fa51894a64a6c16.tar.gz
zsh-b9c19b15a6f01279ddcf32ca6fa51894a64a6c16.tar.xz
zsh-b9c19b15a6f01279ddcf32ca6fa51894a64a6c16.zip
zsh-workers/9065
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 6230e2759..dd16efddb 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -951,8 +951,11 @@ cd_try_chdir(char *pfix, char *dest, int hard)
     else
 	unmetafy(buf, &dlen);
 
-    if (lchdir(dest, NULL, hard))	/* Try plain relative first */
-    if (lchdir(buf, NULL, hard)) {
+    /* We try the full path first.  If that fails, try the
+     * argument to cd relatively.  This is useful if the cwd
+     * or a parent directory is renamed in the interim.
+     */
+    if (lchdir(buf, NULL, hard) && lchdir(dest, NULL, hard)) {
 	free(buf);
 	return NULL;
     }