Mercurial > hg > toybox
changeset 1393:3e8ab37a4b60 draft
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.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 18 Jul 2014 18:31:41 -0500 |
parents | 6fbbe46b35d5 |
children | 9dbfd5390b92 |
files | toys/posix/find.c |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/posix/find.c Thu Jul 17 22:52:58 2014 -0500 +++ b/toys/posix/find.c Fri Jul 18 18:31:41 2014 -0500 @@ -143,6 +143,7 @@ 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 @@ } 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;