summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-11 17:04:56 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-11 17:05:23 -0500
commit177810c910348f9958bff22ec9c543637a2d6e8b (patch)
tree2ef3b7ccd95e8512a2b3cfe075ec58a368f5286d /eval.c
parentaeff24ee344e5b9c4f2f9040a02320952e70ccd7 (diff)
downloadbfs-177810c910348f9958bff22ec9c543637a2d6e8b.tar.xz
Keep one fd free for the predicates themselves.
Otherwise -empty may start failing once the dircache grows. It's still possible to cause failures with $ bfs some/big/dir -empty 3</dev/null because one more fd than expected will be allocated, but that's not a common case. It could be worked around by reading /proc/self/fd/ at startup.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 01da7a4..10379a3 100644
--- a/eval.c
+++ b/eval.c
@@ -402,9 +402,9 @@ static int infer_nopenfd() {
}
}
- // Account for std{in,out,err}
- if (ret > 3) {
- ret -= 3;
+ // Account for std{in,out,err}, and allow one free for the predicates
+ if (ret > 4) {
+ ret -= 4;
}
return ret;