From be26a9823261c15c6e737e2e6c8762423cf325b8 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 6 Mar 2019 08:24:38 -0700 Subject: [PATCH 1/1] t/io_uring: stop when max number of files is reached Signed-off-by: Jens Axboe --- t/io_uring.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/io_uring.c b/t/io_uring.c index 7c75c887..c7139f87 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -501,13 +501,19 @@ int main(int argc, char *argv[]) i = 1; while (!do_nop && i < argc) { - struct file *f = &s->files[s->nr_files]; + struct file *f; + if (s->nr_files == MAX_FDS) { + printf("Max number of files (%d) reached\n", MAX_FDS); + break; + } fd = open(argv[i], flags); if (fd < 0) { perror("open"); return 1; } + + f = &s->files[s->nr_files]; f->real_fd = fd; if (get_file_size(f)) { printf("failed getting size of device/file\n"); -- 2.25.1