From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12228 Path: news.gmane.org!.POSTED!not-for-mail From: Natanael Copa Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] fix sysconf for inifinite rlimits Date: Thu, 7 Dec 2017 23:18:54 +0100 Message-ID: <20171207221854.21242-1-ncopa@alpinelinux.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1512685162 13062 195.159.176.226 (7 Dec 2017 22:19:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 7 Dec 2017 22:19:22 +0000 (UTC) Cc: Natanael Copa To: musl@lists.openwall.com Original-X-From: musl-return-12244-gllmg-musl=m.gmane.org@lists.openwall.com Thu Dec 07 23:19:19 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 1eN4Vj-0003GZ-3y for gllmg-musl@m.gmane.org; Thu, 07 Dec 2017 23:19:19 +0100 Original-Received: (qmail 21569 invoked by uid 550); 7 Dec 2017 22:19:24 -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 21531 invoked from network); 7 Dec 2017 22:19:23 -0000 X-Mailer: git-send-email 2.15.0 Xref: news.gmane.org gmane.linux.lib.musl.general:12228 Archived-At: 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