summary refs log tree commit diff
path: root/io/ftw.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-01-12 22:54:47 +0000
committerUlrich Drepper <drepper@redhat.com>2003-01-12 22:54:47 +0000
commitb2608c22036ee37754d87185c29a0b986b7e70c6 (patch)
treeed9d8ac242ba7cb8915000162b3a699f5eef63a0 /io/ftw.c
parenta5ce5fcf3830323f2d72c203491fa88a63a07036 (diff)
downloadglibc-b2608c22036ee37754d87185c29a0b986b7e70c6.tar.gz
glibc-b2608c22036ee37754d87185c29a0b986b7e70c6.tar.xz
glibc-b2608c22036ee37754d87185c29a0b986b7e70c6.zip
Update.
	* io/ftwtest-sh: Add test case for relative path with /. at the end.

2003-01-12  Jim Meyering  <jim@meyering.net>

	* io/ftw.c (ftw_startup): When trying to stat the starting directory,
	use the basename if we've already chdir'd into its parent directory.

2003-01-12  Ulrich Drepper  <drepper@redhat.com>

	to change directory after call to ftw_dir.
Diffstat (limited to 'io/ftw.c')
-rw-r--r--io/ftw.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/io/ftw.c b/io/ftw.c
index f93d00f332..eceb4040d0 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -358,7 +358,7 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
 			}
 		      else
 			if (__chdir ("..") < 0)
-			  result = 1;
+			  result = -1;
 		    }
 		}
 	    }
@@ -584,9 +584,13 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
   /* Get stat info for start directory.  */
   if (result == 0)
     {
+      const char *name = ((data.flags & FTW_CHDIR)
+			  ? data.dirbuf + data.ftw.base
+			  : data.dirbuf);
+
       if (((flags & FTW_PHYS)
-	   ? LXSTAT (_STAT_VER, data.dirbuf, &st)
-	   : XSTAT (_STAT_VER, data.dirbuf, &st)) < 0)
+	   ? LXSTAT (_STAT_VER, name, &st)
+	   : XSTAT (_STAT_VER, name, &st)) < 0)
 	{
 	  if (!(flags & FTW_PHYS)
 	      && errno == ENOENT