From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10376 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] getdtablesize: Fix returning hard instead of soft rlimit Date: Sat, 13 Aug 2016 15:25:02 -0400 Message-ID: <20160813192501.GE15995@brightrain.aerifal.cx> References: <20160813183149.6886-1-jjk@jjacky.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1471116322 21753 195.159.176.226 (13 Aug 2016 19:25:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 13 Aug 2016 19:25:22 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-10389-gllmg-musl=m.gmane.org@lists.openwall.com Sat Aug 13 21:25:19 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1bYeYY-0005UR-Nx for gllmg-musl@m.gmane.org; Sat, 13 Aug 2016 21:25:18 +0200 Original-Received: (qmail 29823 invoked by uid 550); 13 Aug 2016 19:25:17 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 29802 invoked from network); 13 Aug 2016 19:25:16 -0000 Content-Disposition: inline In-Reply-To: <20160813183149.6886-1-jjk@jjacky.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10376 Archived-At: On Sat, Aug 13, 2016 at 08:31:49PM +0200, Olivier Brunel wrote: > --- > src/legacy/getdtablesize.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/legacy/getdtablesize.c b/src/legacy/getdtablesize.c > index 682da6d..b30c193 100644 > --- a/src/legacy/getdtablesize.c > +++ b/src/legacy/getdtablesize.c > @@ -7,5 +7,5 @@ int getdtablesize(void) > { > struct rlimit rl; > getrlimit(RLIMIT_NOFILE, &rl); > - return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX; > + return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX; Is there a motivation for this? Rich