summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-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;
     }