aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/find.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 051c2702..a5a95d96 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -342,8 +342,13 @@ static int do_find(struct dirtree *new)
int i = 0, d = atolx(ss[1]);
while ((dt = dt->parent)) i++;
-
- test = s[1] == 'i' ? i >= d : i <= d;
+ if (s[1] == 'i') {
+ test = i >= d;
+ if (i == d && not) recurse = 0;
+ } else {
+ test = i <= d;
+ if (i == d && !not) recurse = 0;
+ }
}
} else if (!strcmp(s, "user") || !strcmp(s, "group")
|| !strcmp(s, "newer"))