From: Bin Meng <bmeng@tinylab.org>
To: qemu-devel@nongnu.org
Cc: Zhangjin Wu <falcon@tinylab.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: [PATCH v2 2/6] tests/tcg/cris: Correct the off-by-one error
Date: Fri, 16 Jun 2023 23:27:33 +0800 [thread overview]
Message-ID: <20230616152737.23545-3-bmeng@tinylab.org> (raw)
In-Reply-To: <20230616152737.23545-1-bmeng@tinylab.org>
sysconf(_SC_OPEN_MAX) returns the maximum number of files that
a process can have open at any time, which means the fd should
not be larger than or equal to the return value.
Signed-off-by: Bin Meng <bmeng@tinylab.org>
---
(no changes since v1)
tests/tcg/cris/libc/check_openpf5.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/tcg/cris/libc/check_openpf5.c b/tests/tcg/cris/libc/check_openpf5.c
index 0037fbca4c..7f585c6d37 100644
--- a/tests/tcg/cris/libc/check_openpf5.c
+++ b/tests/tcg/cris/libc/check_openpf5.c
@@ -31,10 +31,10 @@ int main(int argc, char *argv[])
strcpy(fn, "/");
strcat(fn, argv[0]);
- for (i = 0; i < filemax + 1; i++) {
+ for (i = 0; i < filemax; i++) {
if (open(fn, O_RDONLY) < 0) {
/* Shouldn't happen too early. */
- if (i < filemax - 3 - 1) {
+ if (i < filemax - 3) {
fprintf(stderr, "i: %d\n", i);
abort();
}
--
2.34.1
next prev parent reply other threads:[~2023-06-16 15:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 15:27 [PATCH v2 0/6] net/tap: Fix QEMU frozen issue when the maximum number of file descriptors is very large Bin Meng
2023-06-16 15:27 ` [PATCH v2 1/6] tests/tcg/cris: Fix the coding style Bin Meng
2023-06-19 6:55 ` Richard Henderson
2023-06-16 15:27 ` Bin Meng [this message]
2023-06-19 6:55 ` [PATCH v2 2/6] tests/tcg/cris: Correct the off-by-one error Richard Henderson
2023-06-16 15:27 ` [PATCH v2 3/6] util/async-teardown: Fall back to close fds one by one Bin Meng
2023-06-19 6:59 ` Richard Henderson
2023-06-16 15:27 ` [PATCH v2 4/6] utils/osdep: Introduce qemu_close_range() Bin Meng
2023-06-19 7:03 ` Richard Henderson
2023-06-19 7:07 ` Richard Henderson
2023-06-16 15:27 ` [PATCH v2 5/6] util/async-teardown: Use qemu_close_range() to close fds Bin Meng
2023-06-19 7:05 ` Richard Henderson
2023-06-16 15:27 ` [PATCH v2 6/6] net: tap: " Bin Meng
2023-06-19 7:08 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230616152737.23545-3-bmeng@tinylab.org \
--to=bmeng@tinylab.org \
--cc=edgar.iglesias@gmail.com \
--cc=falcon@tinylab.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).