From 935758ab7febbf1c46323d530fae2bae1dfd23d5 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 18 Aug 2013 20:24:45 -0700 Subject: 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. --- Src/builtin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Src/builtin.c') 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; } -- cgit 1.4.1