From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12237 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] fix sysconf for inifinite rlimits Date: Thu, 14 Dec 2017 21:28:09 -0500 Message-ID: <20171215022809.GF1627@brightrain.aerifal.cx> References: <20171207221854.21242-1-ncopa@alpinelinux.org> 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 1513304900 31826 195.159.176.226 (15 Dec 2017 02:28:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 02:28:20 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12253-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 15 03:28:17 2017 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 1ePfjU-00086a-Rs for gllmg-musl@m.gmane.org; Fri, 15 Dec 2017 03:28:16 +0100 Original-Received: (qmail 8032 invoked by uid 550); 15 Dec 2017 02:28:22 -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 8014 invoked from network); 15 Dec 2017 02:28:21 -0000 Content-Disposition: inline In-Reply-To: <20171207221854.21242-1-ncopa@alpinelinux.org> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12237 Archived-At: On Thu, Dec 07, 2017 at 11:18:54PM +0100, Natanael Copa wrote: > sysconf should return -1 for infinity, not LONG_MAX. > --- > src/conf/sysconf.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/conf/sysconf.c b/src/conf/sysconf.c > index b8b761d0..9ce330a5 100644 > --- a/src/conf/sysconf.c > +++ b/src/conf/sysconf.c > @@ -174,6 +174,8 @@ long sysconf(int name) > } else if (values[name] < -256) { > struct rlimit lim; > getrlimit(values[name]&16383, &lim); > + if (lim.rlim_cur == RLIM_INFINITY) > + return -1; > return lim.rlim_cur > LONG_MAX ? LONG_MAX : lim.rlim_cur; > } > > -- > 2.15.0 Thanks. Committing with typo fix. ;-) Rich