diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-09-04 14:55:25 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-09-08 09:39:13 +0200 |
commit | 686f2ea18374a541d203cfcc0e1dfba1666f49c2 (patch) | |
tree | 107da35da6f6427f2e3f09a7578ba384f0c302c4 | |
parent | c66c908230169c1bab1f83b071eb585baa214b9f (diff) | |
download | glibc-686f2ea18374a541d203cfcc0e1dfba1666f49c2.tar.gz glibc-686f2ea18374a541d203cfcc0e1dfba1666f49c2.tar.xz glibc-686f2ea18374a541d203cfcc0e1dfba1666f49c2.zip |
posix: accept inode 0 is a valid inode number (BZ #19971)
According to this kernel commit 2adc376c55194, d_ino 0 is a regular inode number on Linux (which also matches POSIX, as it does not treat the value as special). This patch makes glob accept is a valid inode number. This is also a sync with gnulib commit c8e57c1. Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. [BZ #1062] [BZ #19971] * posix/glob.c (struct readdir_result): Remove skip_entry member. (readdir_result_skip_entry, D_INO_TO_RESULT): Remove. All uses removed.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | posix/glob.c | 21 |
2 files changed, 6 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog index 4fdc0bcc3b..d48cca3c24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ 2017-09-08 Adhemerval Zanella <adhemerval.zanella@linaro.org> [BZ #1062] + [BZ #19971] + * posix/glob.c (struct readdir_result): Remove skip_entry member. + (readdir_result_skip_entry, D_INO_TO_RESULT): Remove. + All uses removed. + + [BZ #1062] * posix/Makefile (routines): Add globfree, globfree64, and glob_pattern_p. * posix/flexmember.h: New file. diff --git a/posix/glob.c b/posix/glob.c index a7eccf9cb4..dbf88ffe2b 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -113,9 +113,6 @@ struct readdir_result #if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE dirent_type type; #endif -#if defined _LIBC || defined D_INO_IN_DIRENT - bool skip_entry; -#endif }; /* Initialize and return type member of struct readdir_result. */ @@ -131,28 +128,12 @@ readdir_result_type (struct readdir_result d) #endif } -/* Initialize and return skip_entry member of struct readdir_result. */ -static bool -readdir_result_skip_entry (struct readdir_result d) -{ -/* Initializer for skip_entry. POSIX does not require that the d_ino - field be present, and some systems do not provide it. */ -#if defined _LIBC || defined D_INO_IN_DIRENT -# define D_INO_TO_RESULT(source) (source)->d_ino == 0, - return d.skip_entry; -#else -# define D_INO_TO_RESULT(source) - return false; -#endif -} - /* Construct an initializer for a struct readdir_result object from a struct dirent *. No copy of the name is made. */ #define READDIR_RESULT_INITIALIZER(source) \ { \ source->d_name, \ D_TYPE_TO_RESULT (source) \ - D_INO_TO_RESULT (source) \ } /* Call gl_readdir on STREAM. This macro can be overridden to reduce @@ -1542,8 +1523,6 @@ glob_in_dir (const char *pattern, const char *directory, int flags, } if (d.name == NULL) break; - if (readdir_result_skip_entry (d)) - continue; /* If we shall match only directories use the information provided by the dirent call if possible. */ |