about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-03-20 22:52:56 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-03-20 22:52:56 +0000
commit28a809886d3df86ffb07c302ff717b621caf22a2 (patch)
treeea96b6c4b49327e567cdd521f929a517135839a1 /Src/utils.c
parent249148d765d846f35d9e3805a89f978892c74208 (diff)
downloadzsh-28a809886d3df86ffb07c302ff717b621caf22a2.tar.gz
zsh-28a809886d3df86ffb07c302ff717b621caf22a2.tar.xz
zsh-28a809886d3df86ffb07c302ff717b621caf22a2.zip
26763: fix problem on failed cd -s to relative path
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Src/utils.c b/Src/utils.c
index e66d5bbf9..9716e162c 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5388,11 +5388,7 @@ lchdir(char const *path, struct dirsav *d, int hard)
     if (*path == '/') {
 #endif
 	level = -1;
-#ifdef HAVE_FCHDIR
-	if (d->dirfd < 0 && (d->dirfd = open(".", O_RDONLY | O_NOCTTY)) < 0 &&
-	    zgetdir(d) && *d->dirname != '/')
-	    d->dirfd = open("..", O_RDONLY | O_NOCTTY);
-#else
+#ifndef HAVE_FCHDIR
 	if (!d->dirname)
 	    zgetdir(d);
 #endif
@@ -5404,6 +5400,11 @@ lchdir(char const *path, struct dirsav *d, int hard)
 	    d->ino = st1.st_ino;
 	}
     }
+#ifdef HAVE_FCHDIR
+    if (d->dirfd < 0 && (d->dirfd = open(".", O_RDONLY | O_NOCTTY)) < 0 &&
+	zgetdir(d) && *d->dirname != '/')
+	d->dirfd = open("..", O_RDONLY | O_NOCTTY);
+#endif
 
 #ifdef HAVE_LSTAT
     if (!hard)