diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-12-10 23:59:02 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-12-10 23:59:02 +0000 |
commit | 1b1135980418c7825be04b835d09037d1c27bcaa (patch) | |
tree | d05acbf732ba6619139e6a1238afb48c7cb82538 | |
parent | 870a4e12539d12200d7946b0c7e1f6ca45530262 (diff) | |
download | glibc-1b1135980418c7825be04b835d09037d1c27bcaa.tar.gz glibc-1b1135980418c7825be04b835d09037d1c27bcaa.tar.xz glibc-1b1135980418c7825be04b835d09037d1c27bcaa.zip |
Update.
2001-12-10 Thorsten Kukuk <kukuk@suse.de> * io/ftw.c (ftw_startup): Check, if the path is search and readable. * io/Makefile (tests): Add bug-ftw3. * io/bug-ftw3.c: New file.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | io/Makefile | 2 | ||||
-rw-r--r-- | io/bug-ftw3.c | 46 | ||||
-rw-r--r-- | io/ftw.c | 3 |
4 files changed, 57 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 3eeeff68bb..e954c3a94d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ +2001-12-10 Thorsten Kukuk <kukuk@suse.de> + + * io/ftw.c (ftw_startup): Check, if the path is search and readable. + 2001-12-10 Ulrich Drepper <drepper@redhat.com> + * io/Makefile (tests): Add bug-ftw3. + * io/bug-ftw3.c: New file. + * sysdeps/generic/glob.c (glob): Return only pattern if nothing matches and GLOB_NOCHECK is set. * posix/globtest.sh: Correct expected result for NOCHECK test. diff --git a/io/Makefile b/io/Makefile index b96421b863..0c39fa859f 100644 --- a/io/Makefile +++ b/io/Makefile @@ -56,7 +56,7 @@ static-only-routines = stat fstat lstat mknod stat64 fstat64 lstat64 others := pwd test-srcs := ftwtest tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ - tst-fcntl bug-ftw1 bug-ftw2 + tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 distribute := ftwtest-sh diff --git a/io/bug-ftw3.c b/io/bug-ftw3.c new file mode 100644 index 0000000000..98bb563f0c --- /dev/null +++ b/io/bug-ftw3.c @@ -0,0 +1,46 @@ +#include <errno.h> +#include <ftw.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +static int +cb (const char *fname, const struct stat *st, int flag) +{ + printf ("%s %d\n", fname, flag); + return 0; +} + +int +main (void) +{ + char tmp[] = "/tmp/ftwXXXXXX"; + char *dname; + int r; + int e; + + dname = mkdtemp (tmp); + if (dname == NULL) + { + printf ("mkdtemp: %m\n"); + exit (1); + } + + if (chmod (dname, S_IWUSR|S_IXUSR|S_IWGRP|S_IXGRP|S_IWOTH|S_IXOTH) != 0) + { + printf ("chmod: %m\n"); + exit (1); + } + + r = ftw (dname, cb, 10); + e = errno; + printf ("r = %d", r); + if (r != 0) + printf (", errno = %d", errno); + puts (""); + + chmod (dname, S_IRWXU|S_IRWXG|S_IRWXO); + rmdir (dname); + + return r != -1 && e == EACCES; +} diff --git a/io/ftw.c b/io/ftw.c index 862774c972..cbd6be707e 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -473,6 +473,9 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, return -1; } + if (__access (dir, R_OK) != 0) + return -1; + data.maxdir = descriptors < 1 ? 1 : descriptors; data.actdir = 0; data.dirstreams = (struct dir_data **) alloca (data.maxdir |