diff mbox series

memfd_create04: Add SAFE_CLOSE before test return

Message ID 20220322030245.209032-1-zhaogongyi@huawei.com
State Accepted
Headers show
Series memfd_create04: Add SAFE_CLOSE before test return | expand

Commit Message

Zhao Gongyi March 22, 2022, 3:02 a.m. UTC
If we run the test with the option -i 511, and the ulimit of
open files little than 1024, the test would fail and report:
memfd_create04.c:75: TFAIL: memfd_create() failed unexpectedly: EMFILE (24)

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

--
2.17.1

Comments

Cyril Hrubis March 22, 2022, 3:42 p.m. UTC | #1
Hi!
Applied, thanks.
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create04.c b/testcases/kernel/syscalls/memfd_create/memfd_create04.c
index dc6e195f0..7b699b218 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create04.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create04.c
@@ -79,6 +79,8 @@  static void memfd_huge_x_controller(unsigned int n)
 	tst_res(TPASS,
 		"memfd_create succeeded for %s page size",
 		tflag.h_size);
+
+	SAFE_CLOSE(fd);
 }

 static void setup(void)