public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Shahar Hochma <shaharhoch@gmail.com>
To: fstests@vger.kernel.org
Cc: Shahar Hochma <shaharhoch@gmail.com>
Subject: [PATCH] t_readdir_3: Allow EOF on ignore_error
Date: Sun,  4 Jan 2026 12:28:16 +0200	[thread overview]
Message-ID: <20260104102816.1542861-1-shaharhoch@gmail.com> (raw)

ignore_error is used when providing random input to setpos.
This can, by chance, produce a valid response from readdir,
but with EOF. In which case, we don't want the test to fail.

Signed-off-by: Shahar Hochma <shaharhoch@gmail.com>
---
 src/t_readdir_3.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/t_readdir_3.c b/src/t_readdir_3.c
index 8f9bb326..5d7afddc 100644
--- a/src/t_readdir_3.c
+++ b/src/t_readdir_3.c
@@ -52,12 +52,12 @@ static void libc_getentry(struct dirent *entry)
 	errno = 0;
 	ret = readdir(dir);
 	if (!ret) {
+		if (ignore_error)
+			return;
 		if (errno == 0) {
 			fprintf(stderr, "Unexpected EOF while reading dir.\n");
 			exit(1);
 		}
-		if (ignore_error)
-			return;
 		perror("readdir");
 		exit(1);
 	}
@@ -92,6 +92,8 @@ static void kernel_getentry(struct dirent *entry)
 		exit(1);
 	}
 	if (ret == 0) {
+		if (ignore_error)
+			return;
 		fprintf(stderr, "Unexpected EOF while reading dir.\n");
 		exit(1);
 	}
-- 
2.52.0.351.gbe84eed79e-goog


             reply	other threads:[~2026-01-04 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-04 10:28 Shahar Hochma [this message]
2026-01-07  8:25 ` [PATCH] t_readdir_3: Allow EOF on ignore_error Christoph Hellwig
     [not found]   ` <CAHeNByfyTHSL-UHboz_8OtcdXDDfxA+BJ_awkVw3s_50c61e5g@mail.gmail.com>
2026-01-07  8:41     ` Christoph Hellwig

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=20260104102816.1542861-1-shaharhoch@gmail.com \
    --to=shaharhoch@gmail.com \
    --cc=fstests@vger.kernel.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