[LTP] [PATCH] syscalls/acct02.c: Fix EMFILE error

Xiao Yang ice_yangxiao@163.com
Sat Jun 8 12:27:13 CEST 2019


Running acct02 with "-i large number" option may get EMFILE error,
because 'fd' file descriptor is not closed on each iteration.

Signed-off-by: Xiao Yang <ice_yangxiao@163.com>
---
 testcases/kernel/syscalls/acct/acct02.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/acct/acct02.c b/testcases/kernel/syscalls/acct/acct02.c
index 8a99bb9..f61faf2 100644
--- a/testcases/kernel/syscalls/acct/acct02.c
+++ b/testcases/kernel/syscalls/acct/acct02.c
@@ -140,6 +140,8 @@ static void run(void)
 		tst_res(TPASS, "acct() wrote correct file contents!");
 	else
 		tst_res(TFAIL, "acct() wrote incorrect file contents!");
+
+	SAFE_CLOSE(fd);
 }
 
 static void setup(void)
-- 
1.8.3.1




More information about the ltp mailing list