diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-02-11 17:04:56 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-02-11 17:05:23 -0500 |
commit | 177810c910348f9958bff22ec9c543637a2d6e8b (patch) | |
tree | 2ef3b7ccd95e8512a2b3cfe075ec58a368f5286d /eval.c | |
parent | aeff24ee344e5b9c4f2f9040a02320952e70ccd7 (diff) | |
download | bfs-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.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; |