From b9c19b15a6f01279ddcf32ca6fa51894a64a6c16 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Wed, 15 Dec 1999 18:45:53 +0000 Subject: zsh-workers/9065 --- Src/builtin.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Src/builtin.c') 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; } -- cgit 1.4.1