about summary refs log tree commit diff
path: root/io/ftwtest.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-08 18:29:49 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-08 18:29:49 +0000
commit34c86f425441d13e9e6cebd2ce1ebd99fc373ce2 (patch)
treebe85fca7458e1d4c889ec278868d5d091462bee7 /io/ftwtest.c
parentae9ecd08db965a4987a4d1351e2c51deb5c6e9b5 (diff)
downloadglibc-34c86f425441d13e9e6cebd2ce1ebd99fc373ce2.tar.gz
glibc-34c86f425441d13e9e6cebd2ce1ebd99fc373ce2.tar.xz
glibc-34c86f425441d13e9e6cebd2ce1ebd99fc373ce2.zip
Update.
2003-02-08  Ulrich Drepper  <drepper@redhat.com>

	* io/ftwtest.c: Get current working directory before and after the
	nftw call and make sure they match.

2003-02-08  Jim Meyering  <jim@meyering.net>

	* ftw.c (ftw_startup): When using FTW_CHDIR, always remember
	the current directory, not just when DIR contains a slash.
	Reported by Manoj Srivastava.
Diffstat (limited to 'io/ftwtest.c')
-rw-r--r--io/ftwtest.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/io/ftwtest.c b/io/ftwtest.c
index 851ed1d587..4f527997df 100644
--- a/io/ftwtest.c
+++ b/io/ftwtest.c
@@ -70,9 +70,22 @@ main (int argc, char *argv[])
   if (do_phys)
     flag |= FTW_PHYS;
 
+  char *cw1 = getcwd (NULL, 0);
+
   r = nftw (optind < argc ? argv[optind] : ".", cb, do_exit ? 1 : 3, flag);
   if (r < 0)
     perror ("nftw");
+
+  char *cw2 = getcwd (NULL, 0);
+
+  if (strcmp (cw1, cw2) != 0)
+    {
+      printf ("current working directory before and after nftw call differ:\n"
+	      "before: %s\n"
+	      "after:  %s\n", cw1, cw2);
+      exit (1);
+    }
+
   if (do_exit)
     {
       puts (r == 26 ? "succeeded" : "failed");