* [LTP] [PATCH] unlinkat01: Add SAFE_CLOSE before test return
@ 2022-03-25 7:33 Zhao Gongyi via ltp
2022-03-25 9:07 ` Petr Vorel
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Gongyi via ltp @ 2022-03-25 7:33 UTC (permalink / raw)
To: ltp
If we run the test with the option -i 10000, and the ulimit
of open files little than 10000, the test would fail and report
error of EMFILE.
Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
testcases/kernel/syscalls/unlinkat/unlinkat01.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/unlinkat/unlinkat01.c b/testcases/kernel/syscalls/unlinkat/unlinkat01.c
index 9e9a5d7db..4f5a6da1e 100644
--- a/testcases/kernel/syscalls/unlinkat/unlinkat01.c
+++ b/testcases/kernel/syscalls/unlinkat/unlinkat01.c
@@ -52,13 +52,14 @@ static struct tcase {
static void run(unsigned int i)
{
+ int fd_testfile3 = -1;
/* tesfile2 will be unlinked by test0. */
if (access(testfile2, F_OK))
SAFE_FILE_PRINTF(testfile2, testfile2);
/* testfile3 will be unlined by test1. */
if (access(testfile3, F_OK))
- SAFE_OPEN(testfile3, O_CREAT | O_RDWR, 0600);
+ fd_testfile3 = SAFE_OPEN(testfile3, O_CREAT | O_RDWR, 0600);
/* subpathdir will be unlinked by test6. */
if (access(subpathdir, F_OK))
@@ -80,6 +81,8 @@ static void run(unsigned int i)
if (!tc[i].fd)
SAFE_CLOSE(fd);
+ if (fd_testfile3 > 0)
+ SAFE_CLOSE(fd_testfile3);
}
static void setup(void)
--
2.17.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] unlinkat01: Add SAFE_CLOSE before test return
2022-03-25 7:33 [LTP] [PATCH] unlinkat01: Add SAFE_CLOSE before test return Zhao Gongyi via ltp
@ 2022-03-25 9:07 ` Petr Vorel
0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2022-03-25 9:07 UTC (permalink / raw)
To: Zhao Gongyi; +Cc: ltp
Hi Zhao,
I rewritten the commit message and
s/fd_testfile3/fd3/
Merged, thanks!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-25 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-25 7:33 [LTP] [PATCH] unlinkat01: Add SAFE_CLOSE before test return Zhao Gongyi via ltp
2022-03-25 9:07 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox