summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-04-16 12:14:02 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-04-16 12:14:02 -0400
commite42e0f1012229e4473919c738ab7e4bcaff8033a (patch)
treed4e7d16a4e2ece4b4de1aac1d8075369d8d645a0 /eval.c
parent455b724279c1cb4aefc0d2f81b65641990dd7689 (diff)
downloadbfs-e42e0f1012229e4473919c738ab7e4bcaff8033a.tar.xz
Implement -X
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 929eeba..8c33d21 100644
--- a/eval.c
+++ b/eval.c
@@ -964,6 +964,13 @@ static enum bftw_action cmdline_callback(struct BFTW *ftwbuf, void *ptr) {
goto done;
}
+ if (cmdline->xargs_safe && strpbrk(ftwbuf->path, " \t\n\'\"\\")) {
+ args->ret = -1;
+ cfprintf(cmdline->cerr, "%{er}'%s': Path is not safe for xargs.%{rs}\n", ftwbuf->path);
+ state.action = BFTW_SKIP_SUBTREE;
+ goto done;
+ }
+
if (ftwbuf->depth >= cmdline->maxdepth) {
state.action = BFTW_SKIP_SUBTREE;
}