diff mbox series

[v2,2/2] pipe07: refactor exp_num_pipes

Message ID 20231002173416.1080347-3-edliaw@google.com
State Accepted
Headers show
Series pipe07: close /proc/self/fd after counting fds | expand

Commit Message

Edward Liaw Oct. 2, 2023, 5:34 p.m. UTC
Move doubling the exp_num_pipes into the value.

Signed-off-by: Edward Liaw <edliaw@google.com>
---
 testcases/kernel/syscalls/pipe/pipe07.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Petr Vorel Oct. 26, 2023, 10:03 a.m. UTC | #1
Hi Edward,

Thanks, merged.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c
index d9b23044d..8098007c2 100644
--- a/testcases/kernel/syscalls/pipe/pipe07.c
+++ b/testcases/kernel/syscalls/pipe/pipe07.c
@@ -58,8 +58,8 @@  static void setup(void)
 	tst_res(TINFO, "getdtablesize() = %d", max_fds);
 	pipe_fds = SAFE_MALLOC(max_fds * sizeof(int));
 
-	exp_num_pipes = (max_fds - record_open_fds()) / 2;
-	tst_res(TINFO, "expected max fds to be opened by pipe(): %d", exp_num_pipes * 2);
+	exp_num_pipes = (max_fds - record_open_fds()) / 2 * 2;
+	tst_res(TINFO, "expected max fds to be opened by pipe(): %d", exp_num_pipes);
 }
 
 static void run(void)
@@ -75,7 +75,7 @@  static void run(void)
 	} while (!TST_RET);
 
 	TST_EXP_EQ_LI(errno, EMFILE);
-	TST_EXP_EQ_LI(exp_num_pipes * 2, num_pipe_fds);
+	TST_EXP_EQ_LI(exp_num_pipes, num_pipe_fds);
 
 	for (int i = 0; i < num_pipe_fds; i++)
 		SAFE_CLOSE(pipe_fds[i]);