[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/11] getdtablesize: Fix RLIMIT_NOFILE fallback case
From: |
Kevin Cernekee |
Subject: |
[PATCH 11/11] getdtablesize: Fix RLIMIT_NOFILE fallback case |
Date: |
Wed, 11 Feb 2015 15:22:59 -0800 |
* lib/getdtablesize.c: Use rlim_cur instead of rlim_max, to match
glibc behavior. test-getdtablesize and test-dup2 both assume
they will be able to create a file descriptor numbered
(getdtablesize()-1), and will fail if rlim_max > rlim_cur.
---
ChangeLog | 6 ++++++
lib/getdtablesize.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index be46fe9c1388..084338489148 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,6 +58,12 @@
* doc/posix-headers/monetary.texi: Add Android to the list of
platforms missing monetary.h.
+ getdtablesize: Fix RLIMIT_NOFILE fallback case
+ * lib/getdtablesize.c: Use rlim_cur instead of rlim_max, to match
+ glibc behavior. test-getdtablesize and test-dup2 both assume
+ they will be able to create a file descriptor numbered
+ (getdtablesize()-1), and will fail if rlim_max > rlim_cur.
+
2015-02-08 Daiki Ueno <address@hidden>
uniname/unimame-tests: don't link with -lunistring
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 59b97360bc57..e23c67d487f8 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -99,8 +99,8 @@ rpl_getdtablesize(void)
a smaller soft limit, the smaller limit is not enforced, so
we might as well just report the hard limit. */
struct rlimit lim;
- if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_max != RLIM_INFINITY)
- return lim.rlim_max;
+ if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_cur != RLIM_INFINITY)
+ return lim.rlim_cur;
return getdtablesize ();
}
--
2.2.0.rc0.207.ga3a616c
- [PATCH 00/11] Android compatibility, Kevin Cernekee, 2015/02/11
- [PATCH 01/11] Fix FILE struct compatibility with Android API level >= 21, Kevin Cernekee, 2015/02/11
- [PATCH 02/11] Assume unbroken ungetc() on Android, Kevin Cernekee, 2015/02/11
- [PATCH 03/11] getdtablesize: Fix Android build, Kevin Cernekee, 2015/02/11
- [PATCH 04/11] localename: Fix Android build, Kevin Cernekee, 2015/02/11
- [PATCH 06/11] euidaccess: Fix Android build, Kevin Cernekee, 2015/02/11
- [PATCH 08/11] net_if: Handle content-free <net/if.h> system headers, Kevin Cernekee, 2015/02/11
- [PATCH 07/11] linkat_nofollow: Add fallback case for cross compiling, Kevin Cernekee, 2015/02/11
- [PATCH 05/11] getugroups: Fix Android build, Kevin Cernekee, 2015/02/11
- [PATCH 09/11] signal_h: Fix Android build, Kevin Cernekee, 2015/02/11
- [PATCH 11/11] getdtablesize: Fix RLIMIT_NOFILE fallback case,
Kevin Cernekee <=
- [PATCH 10/11] duplocale: Fix Android build of duplocale-tests, Kevin Cernekee, 2015/02/11
- Re: [PATCH 00/11] Android compatibility, Paul Eggert, 2015/02/11