From: Ulrich Drepper Date: Sun, 12 Jan 2003 20:44:20 +0000 (+0000) Subject: Update. X-Git-Tag: upstream/2.20~13289 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5ce5fcf3830323f2d72c203491fa88a63a07036;p=platform%2Fupstream%2Flinaro-glibc.git Update. 2003-01-12 Ulrich Drepper * 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. --- diff --git a/ChangeLog b/ChangeLog index 4393fa5..c1269a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-01-12 Ulrich Drepper + + * 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. + 2002-01-12 Franz Sirl * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_VFORK_SYSCALL): diff --git a/io/ftw.c b/io/ftw.c index 4debcc0..f93d00f 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; } } } diff --git a/io/ftwtest-sh b/io/ftwtest-sh index 7fc8208..27b8100 100644 --- a/io/ftwtest-sh +++ b/io/ftwtest-sh @@ -138,6 +138,28 @@ base = "$tmp/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 | + sort > $testout +cd "$curwd" + +cat < $testout