diff mbox series

[v2,1/2] pipe07: close /proc/self/fd after counting fds

Message ID 20231002173416.1080347-2-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
Leaving the directory fd open will count against the max number of fds
opened, so the final expected count will be off when (max_fds -
record_open_fds()) is even.

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

Patch

diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c
index 196485684..d9b23044d 100644
--- a/testcases/kernel/syscalls/pipe/pipe07.c
+++ b/testcases/kernel/syscalls/pipe/pipe07.c
@@ -45,6 +45,8 @@  static int record_open_fds(void)
 		opened_fds[num_opened_fds++] = fd;
 	}
 
+	SAFE_CLOSEDIR(dir);
+
 	return num_opened_fds;
 }