aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-07-18 18:31:41 -0500
committerRob Landley <rob@landley.net>2014-07-18 18:31:41 -0500
commita873444aa3e57d05c639c849a41a2add146f0309 (patch)
tree7ce9dc65be8edeeeabe4c90430d05ccf85ce9c88 /toys
parent1f80e11e3b85d72544d3b52178d0ea7a8c36c177 (diff)
downloadtoybox-a873444aa3e57d05c639c849a41a2add146f0309.tar.gz
Find bugfixes.
The check for -print vs -print0 was tested before I optimized out the "-" in the strcmps, and I didn't adjust the offset or retest it. (Ooops.) Also, I wasn't clearing the ! value when descending into parentheticals, so "find . -name blah -o \! \( -stuff -o -thing \)" acted like it had a spurious second ! before -stuff inside the parentheses.
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 cd9da924..873f83cb 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -143,6 +143,7 @@ static int do_find(struct dirtree *new)
if (pcount == sizeof(toybuf)) goto error;
toybuf[pcount++] = not+(active<<1);
if (!check) active = 0;
+ not = 0;
// Pop status, apply deferred not to test
} else if (*s == ')') {
@@ -171,7 +172,7 @@ static int do_find(struct dirtree *new)
} else if (!strcmp(s, "print") || !strcmp("print0", s)) {
print++;
- if (check) do_print(new, s[6] ? 0 : '\n');
+ if (check) do_print(new, s[5] ? 0 : '\n');
} else if (!strcmp(s, "nouser")) {
if (check) if (getpwuid(new->st.st_uid)) test = 0;