summaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
Diffstat (limited to 'findutils')
-rw-r--r--findutils/find.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/findutils/find.c b/findutils/find.c
index aa22441..07cae97 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -180,18 +180,13 @@ static int exec_actions(action ***appp, const char *fileName, struct stat *statb
ACTF(name)
{
- const char *tmp = strrchr(fileName, '/');
- if (tmp == NULL)
- tmp = fileName;
- else {
- tmp++;
- if (!*tmp) { /* "foo/bar/". Oh no... go back to 'b' */
- tmp--;
- while (tmp != fileName && *--tmp != '/')
- continue;
- if (*tmp == '/')
- tmp++;
- }
+ const char *tmp = bb_basename(fileName);
+ if (tmp != fileName && !*tmp) { /* "foo/bar/". Oh no... go back to 'b' */
+ tmp--;
+ while (tmp != fileName && *--tmp != '/')
+ continue;
+ if (*tmp == '/')
+ tmp++;
}
return fnmatch(ap->pattern, tmp, FNM_PERIOD) == 0;
}