about summary refs log tree commit diff
path: root/io/ftw.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-01-12 20:44:20 +0000
committerUlrich Drepper <drepper@redhat.com>2003-01-12 20:44:20 +0000
commita5ce5fcf3830323f2d72c203491fa88a63a07036 (patch)
tree1313d4053d7f25edcf612ff7adc2e20e110409aa /io/ftw.c
parentb398ae3c6da325b334319d061eaa84226dbe3141 (diff)
downloadglibc-a5ce5fcf3830323f2d72c203491fa88a63a07036.tar.gz
glibc-a5ce5fcf3830323f2d72c203491fa88a63a07036.tar.xz
glibc-a5ce5fcf3830323f2d72c203491fa88a63a07036.zip
Update.
2003-01-12  Ulrich Drepper  <drepper@redhat.com>

	* io/ftw.c (process_entry): Use relative path when using chdir()
	to change direcoty after call to ftw_dir.
	* io/ftwtest-sh: Add test for relative path argument to nftw()
	with FTW_CHDIR option.
Diffstat (limited to 'io/ftw.c')
-rw-r--r--io/ftw.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/io/ftw.c b/io/ftw.c
index 4debcc0542..f93d00f332 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -212,7 +212,7 @@ open_dir_stream (struct ftw_data *data, struct dir_data *dirp)
 		{
 		  char *newp;
 		  bufsize += MAX (1024, 2 * this_len);
-		  newp = realloc (buf, bufsize);
+		  newp = (char *) realloc (buf, bufsize);
 		  if (newp == NULL)
 		    {
 		      /* No more memory.  */
@@ -357,15 +357,8 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
 			    result = -1;
 			}
 		      else
-			{
-			  /* Please note that we overwrite a slash.  */
-			  data->dirbuf[data->ftw.base - 1] = '\0';
-
-			  if (__chdir (data->dirbuf) < 0)
-			    result = -1;
-
-			  data->dirbuf[data->ftw.base - 1] = '/';
-			}
+			if (__chdir ("..") < 0)
+			  result = 1;
 		    }
 		}
 	    }