diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2015-12-28 02:22:43 +0100 |
---|---|---|
committer | James Youngman <jay@gnu.org> | 2015-12-28 10:15:31 +0000 |
commit | f5934323090bfa4c07b5b6a7f4c9eb3f419868e7 (patch) | |
tree | caca93fa06316866aa92d28d9f623c474ec82430 | |
parent | 852e4225aff4b304fec445ee322f8cf4a001675a (diff) | |
download | findutils-f5934323090bfa4c07b5b6a7f4c9eb3f419868e7.tar.gz |
maint: avoid sc_prohibit_always_true_header_tests failure.
* configure.ac: Check for getrlimit function directly rather than the
"sys/resource.h" header file.
* lib/fdleak.c: Include "sys/resource.h" when HAVE_GETRLIMIT is set.
(get_max_fd): s/HAVE_GETRUSAGE/HAVE_GETRLIMIT/.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lib/fdleak.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 3db4827a..df8882ae 100644 --- a/configure.ac +++ b/configure.ac @@ -142,7 +142,7 @@ dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h) dnl fdleak.c needs sys/resource.h because it calls getrlimit(2). -AC_CHECK_HEADERS(sys/resource.h) +AC_CHECK_FUNCS(getrlimit) AC_HEADER_MAJOR dnl TODO: it's possible gnulib eliminates the need for AC_HEADER_DIRENT. AC_HEADER_DIRENT diff --git a/lib/fdleak.c b/lib/fdleak.c index c22d2998..2e6c9a9b 100644 --- a/lib/fdleak.c +++ b/lib/fdleak.c @@ -26,7 +26,7 @@ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> -#if defined HAVE_SYS_RESOURCE_H +#if HAVE_GETRLIMIT # include <sys/resource.h> #endif #include <unistd.h> @@ -120,7 +120,7 @@ get_max_fd (void) open_max = _POSIX_OPEN_MAX; /* underestimate */ /* We assume if RLIMIT_NOFILE is defined, all the related macros are, too. */ -#if defined HAVE_GETRUSAGE && defined RLIMIT_NOFILE +#if defined HAVE_GETRLIMIT && defined RLIMIT_NOFILE if (0 == getrlimit (RLIMIT_NOFILE, &fd_limit)) { if (fd_limit.rlim_cur == RLIM_INFINITY) |