Skip to content

Commit

Permalink
test/poll-mshot-update: ensure 'nfiles' doesn't exceed NFILES
Browse files Browse the repository at this point in the history
Fixes: 4faa067 ("test/poll-mshot-update: make the test behave a bit better with file limits")
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Sep 27, 2024
1 parent aa7c727 commit db4b040
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/poll-mshot-update.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ int main(int argc, char *argv[])
if (rlim.rlim_cur < (2 * NFILES + 5)) {
rlim.rlim_cur = rlim.rlim_max;
nfiles = (rlim.rlim_cur / 2) - 5;
if (nfiles > NFILES)
nfiles = NFILES;
if (nfiles <= 0)
goto err_nofail;
if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
Expand Down

0 comments on commit db4b040

Please sign in to comment.