[LTP] [PATCH v2 1/2] pipe07: close /proc/self/fd after counting fds
Edward Liaw
edliaw@google.com
Mon Oct 2 19:34:15 CEST 2023
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 --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;
}
--
2.42.0.582.g8ccd20d70d-goog
More information about the ltp
mailing list