about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2013-08-18 20:24:45 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2013-08-18 20:24:45 -0700
commit935758ab7febbf1c46323d530fae2bae1dfd23d5 (patch)
treed1508c9d7cabd12b6fff75f244541dd3b24c2c00 /Src/builtin.c
parent40a881569fed17177fbd73079dd4d3849517567c (diff)
downloadzsh-935758ab7febbf1c46323d530fae2bae1dfd23d5.tar.gz
zsh-935758ab7febbf1c46323d530fae2bae1dfd23d5.tar.xz
zsh-935758ab7febbf1c46323d530fae2bae1dfd23d5.zip
31637: be more selective about retry of lchdir() in cd_do_chdir()
Change of directory should not be retried relative to the current directory
when it has already failed along some path that does not refer to the
current directory.
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 3159975e3..f8be4acc9 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1125,7 +1125,8 @@ cd_try_chdir(char *pfix, char *dest, int hard)
      * 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)) {
+    if (lchdir(buf, NULL, hard) &&
+	(pfix || *dest == '/' || lchdir(dest, NULL, hard))) {
 	free(buf);
 	return NULL;
     }