aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/find.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 58a6f88d..02fdf3c4 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -368,7 +368,8 @@ static int do_find(struct dirtree *new)
}
if (check) {
- test = !fnmatch(arg, name, FNM_PATHNAME*(!is_path));
+ test = !fnmatch(arg, is_path ? name : basename(name),
+ FNM_PATHNAME*(!is_path));
if (i) free(name);
}
free(path);