summaryrefslogtreecommitdiff
path: root/common/compat.c
diff options
context:
space:
mode:
authorLeonardo Brondani Schenkel <leo@tradeshift.com>2018-05-28 16:18:05 +0200
committerDaiki Ueno <ueno@gnu.org>2018-09-12 14:51:20 +0200
commitf4a9fa674e17cc470d9280237032f18a70313d8e (patch)
tree97f14faaeaea253b34f65ffaf6101d5bda2ac562 /common/compat.c
parent7f1df14e041c6de9603a4720753ca8f31e32b4ff (diff)
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.
Diffstat (limited to 'common/compat.c')
-rw-r--r--common/compat.c2
1 files changed, 2 insertions, 0 deletions
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