[LTP] [PATCH] readdir01: Add closedir before test return

Zhao Gongyi zhaogongyi@huawei.com
Sat Mar 19 08:44:53 CET 2022


If we run the test with option -i 10000, and the ulimit of
open files little than 10000, the test will fail and report:
readdir01.c:48: TBROK: opendir(.) failed: EMFILE (24).

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/kernel/syscalls/readdir/readdir01.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/readdir/readdir01.c b/testcases/kernel/syscalls/readdir/readdir01.c
index e90f50c80..d200145ea 100644
--- a/testcases/kernel/syscalls/readdir/readdir01.c
+++ b/testcases/kernel/syscalls/readdir/readdir01.c
@@ -59,6 +59,8 @@ static void verify_readdir(void)
 		tst_res(TFAIL, "found %s files than were created, created: %d, found: %d",
 					cnt > nfiles ? "more" : "less", nfiles, cnt);
 	}
+
+	SAFE_CLOSEDIR(test_dir);
 }

 static struct tst_test test = {
--
2.17.1



More information about the ltp mailing list