From: Leonardo Brondani Schenkel Date: Mon, 28 May 2018 14:18:05 +0000 (+0200) Subject: common: use /proc only on Linux X-Git-Tag: 0.23.15~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4a9fa674e17cc470d9280237032f18a70313d8e;p=p11-kit 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. --- 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