diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2017-09-09 12:18:41 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2017-09-09 12:18:41 -0400 |
commit | ec92ae82f381169be0223e37f5afd85f0c6d2f21 (patch) | |
tree | 4d0604fbb09690a657672d981b479a1a52c2c52a /eval.c | |
parent | 836fbdf183bca11d3a68eee890978fd7c7fd5dab (diff) | |
download | bfs-ec92ae82f381169be0223e37f5afd85f0c6d2f21.tar.xz |
eval: Make sure nopenfd >= 2 for bftw()
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1170,13 +1170,12 @@ static int infer_fdlimit(const struct cmdline *cmdline) { closedir(dir); } - // Extra fd needed by -empty - int reserved = nopen + 1; + // 1 extra fd needed by -empty + ret -= nopen + 1; - if (ret > reserved) { - ret -= reserved; - } else { - ret = 1; + // bftw() needs at least 2 available fds + if (ret < 2) { + ret = 2; } return ret; |