diff options
author | Kirill Ponomarev <krion@FreeBSD.org> | 2006-05-14 20:23:01 +0000 |
---|---|---|
committer | Kirill Ponomarev <krion@FreeBSD.org> | 2006-05-14 20:23:01 +0000 |
commit | 22170420ec824e09edb8f2c0f30de913712884b9 (patch) | |
tree | 349cde92880cada6ae50eb2f1d12fbfd74df1464 /usr.bin/find/function.c | |
parent | 07399d81d88ca7892d432962347bec00e861820a (diff) | |
download | src-22170420ec824e09edb8f2c0f30de913712884b9.tar.gz src-22170420ec824e09edb8f2c0f30de913712884b9.zip |
The last execution of -exec {} + is not done if the -exec primary is
not on the top-level -and sequence, e.g. inside of ! or -or.
Create a separate linked list of all active -exec {} + primaries and
do the last execution for all at termination.
PR: bin/79263
Submitted by: Jilles Tjoelker <jilles@stack.nl>
MFC after: 7 days
Notes
Notes:
svn path=/head/; revision=158572
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r-- | usr.bin/find/function.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index 38bf813510d3..f1c473ea240a 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -76,6 +76,8 @@ static char *nextarg(OPTION *, char ***); extern char **environ; +static PLAN *lastexecplus = NULL; + #define COMPARE(a, b) do { \ switch (plan->flags & F_ELG_MASK) { \ case F_EQUAL: \ @@ -711,6 +713,8 @@ c_exec(OPTION *option, char ***argvp) new->e_psizemax = argmax; new->e_pbsize = 0; cnt += new->e_pnummax + 1; + new->e_next = lastexecplus; + lastexecplus = new; } if ((new->e_argv = malloc(cnt * sizeof(char *))) == NULL) err(1, NULL); @@ -754,6 +758,19 @@ done: *argvp = argv + 1; return new; } +/* Finish any pending -exec ... {} + functions. */ +void +finish_execplus() +{ + PLAN *p; + + p = lastexecplus; + while (p != NULL) { + (p->execute)(p, NULL); + p = p->e_next; + } +} + int f_flags(PLAN *plan, FTSENT *entry) { |