aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--findutils/find.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 0b06938da..30fb03dd1 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -198,14 +198,19 @@ static int exec_actions(action ***appp, const char *fileName, const struct stat
198ACTF(name) 198ACTF(name)
199{ 199{
200 const char *tmp = bb_basename(fileName); 200 const char *tmp = bb_basename(fileName);
201 if (tmp != fileName && !*tmp) { /* "foo/bar/". Oh no... go back to 'b' */ 201 if (tmp != fileName && *tmp == '\0') {
202 /* "foo/bar/". Oh no... go back to 'b' */
202 tmp--; 203 tmp--;
203 while (tmp != fileName && *--tmp != '/') 204 while (tmp != fileName && *--tmp != '/')
204 continue; 205 continue;
205 if (*tmp == '/') 206 if (*tmp == '/')
206 tmp++; 207 tmp++;
207 } 208 }
208 return fnmatch(ap->pattern, tmp, FNM_PERIOD | (ap->iname ? FNM_CASEFOLD : 0)) == 0; 209 /* Was using FNM_PERIOD flag too,
210 * but somewhere between 4.1.20 and 4.4.0 GNU find stopped using it.
211 * find -name '*foo' should match .foo too:
212 */
213 return fnmatch(ap->pattern, tmp, (ap->iname ? FNM_CASEFOLD : 0)) == 0;
209} 214}
210 215
211#if ENABLE_FEATURE_FIND_PATH 216#if ENABLE_FEATURE_FIND_PATH