From b2608c22036ee37754d87185c29a0b986b7e70c6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 12 Jan 2003 22:54:47 +0000 Subject: Update. * io/ftwtest-sh: Add test case for relative path with /. at the end. 2003-01-12 Jim Meyering * 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 to change directory after call to ftw_dir. --- io/ftw.c | 10 +++++++--- io/ftwtest-sh | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'io') 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 diff --git a/io/ftwtest-sh b/io/ftwtest-sh index 27b810073d..4f3b7865e8 100644 --- a/io/ftwtest-sh +++ b/io/ftwtest-sh @@ -160,6 +160,28 @@ base = "ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd = $tm EOF rm $testout +curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` +cd "$tmp" +LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. | + sort > $testout +cd "$curwd" + +cat < $testout -- cgit v1.2.3