[v7,1/6] tests: use /dev/fd to count open fds

Submitted by Leonid Bobrov on Feb. 25, 2019, 6:21 p.m.

Details

Message ID 20190225182123.65203-1-mazocomp@disroot.org
State Not Applicable
Headers show
Series "Series without cover letter" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Leonid Bobrov Feb. 25, 2019, 6:21 p.m.
From: Johannes Lundberg <johalun@FreeBSD.org>

*BSD don't have /proc/self/fd, they use /dev/fd instead.
At Linux /dev/fd is a symlink to /proc/self/fd

Signed-off-by: Johannes Lundberg <johalun@FreeBSD.org>
Signed-off-by: Leonid Bobrov <mazocomp@disroot.org>
---
 tests/test-helpers.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/test-helpers.c b/tests/test-helpers.c
index b2189d8..03419fb 100644
--- a/tests/test-helpers.c
+++ b/tests/test-helpers.c
@@ -47,8 +47,8 @@  count_open_fds(void)
 	struct dirent *ent;
 	int count = 0;
 
-	dir = opendir("/proc/self/fd");
-	assert(dir && "opening /proc/self/fd failed.");
+	dir = opendir("/dev/fd");
+	assert(dir && "opening /dev/fd failed.");
 
 	errno = 0;
 	while ((ent = readdir(dir))) {
@@ -57,7 +57,7 @@  count_open_fds(void)
 			continue;
 		count++;
 	}
-	assert(errno == 0 && "reading /proc/self/fd failed.");
+	assert(errno == 0 && "reading /dev/fd failed.");
 
 	closedir(dir);