From f4a9fa674e17cc470d9280237032f18a70313d8e Mon Sep 17 00:00:00 2001 From: Leonardo Brondani Schenkel Date: Mon, 28 May 2018 16:18:05 +0200 Subject: common: use /proc only on Linux Non-Linux systems do not have /proc, so do not attempt to open it and eliminate an unnecessary access() syscall on those systems. --- common/compat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/compat.c b/common/compat.c index f0e31eb..5a9702d 100644 --- a/common/compat.c +++ b/common/compat.c @@ -912,6 +912,7 @@ fdwalk (int (* cb) (void *data, int fd), struct rlimit rl; #endif +#ifdef __linux__ dir = opendir ("/proc/self/fd"); if (dir != NULL) { while ((de = readdir (dir)) != NULL) { @@ -934,6 +935,7 @@ fdwalk (int (* cb) (void *data, int fd), closedir (dir); return res; } +#endif /* No /proc, brute force */ #ifdef HAVE_SYS_RESOURCE_H -- cgit v1.1