about summary refs log tree commit diff
path: root/io
diff options
context:
space:
mode:
Diffstat (limited to 'io')
-rw-r--r--io/ftw.c2
-rw-r--r--io/ftwtest-sh11
2 files changed, 12 insertions, 1 deletions
diff --git a/io/ftw.c b/io/ftw.c
index eceb4040d0..26dd77fafa 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -594,7 +594,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
 	{
 	  if (!(flags & FTW_PHYS)
 	      && errno == ENOENT
-	      && LXSTAT (_STAT_VER, dir, &st) == 0
+	      && LXSTAT (_STAT_VER, name, &st) == 0
 	      && S_ISLNK (st.st_mode))
 	    result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN],
 				   &data.ftw);
diff --git a/io/ftwtest-sh b/io/ftwtest-sh
index 4f3b7865e8..76c1de7f3e 100644
--- a/io/ftwtest-sh
+++ b/io/ftwtest-sh
@@ -182,6 +182,17 @@ base = "ftwtest.d/./foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd = $
 EOF
 rm $testout
 
+curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
+cd "$tmp"
+LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 |
+    sort > $testout
+cd "$curwd"
+
+cat <<EOF | diff -u $testout - || exit 1
+base = "ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN, cwd = $tmpreal/ftwtest.d/foo/lvl1, level = 0
+EOF
+rm $testout
+
 LD_LIBRARY_PATH=$objpfx $ldso $testprogram --early-exit $tmpdir |
     sort > $testout