aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-03-21 17:15:09 -0500
committerRob Landley <rob@landley.net>2015-03-21 17:15:09 -0500
commit33f04551f3c9a5182aabe9dfe36d6a0b88298686 (patch)
tree1ea3750163b81bb27ec928f347e358a628183003 /toys
parent0d39f2f52bad3df1b156bc51dcd8e6f1debc09f7 (diff)
downloadtoybox-33f04551f3c9a5182aabe9dfe36d6a0b88298686.tar.gz
Another bug from David Halls: find -exec wasn't consuming its argument when it didn't activate.
test: find . -name README -exec echo one '{}' ';' -or -exec echo two '{}' ';'
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/find.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 3607874a..69e370d4 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -435,7 +435,7 @@ static int do_find(struct dirtree *new)
if (aa->dir && TT.topdir == -1) TT.topdir = xopen(".", 0);
// collect names and execute commands
- } else if (check) {
+ } else {
char *name, *ss1 = ss[1];
struct double_list **ddl;
@@ -443,11 +443,12 @@ static int do_find(struct dirtree *new)
aa = (void *)llist_pop(&argdata);
ss += aa->arglen + 1;
+ if (!check) goto cont;
// name is always a new malloc, so we can always free it.
name = aa->dir ? xstrdup(new->name) : dirtree_path(new, 0);
// Mark entry so COMEAGAIN can call flush_exec() in parent.
- // This is never a valid pointer valud for prev to have otherwise
+ // This is never a valid pointer value for prev to have otherwise
if (aa->dir) aa->prev = (void *)1;
if (*s == 'o') {