From: Natanael Copa <ncopa@alpinelinux.org>
To: musl@lists.openwall.com
Cc: Natanael Copa <ncopa@alpinelinux.org>
Subject: [PATCH] fix sysconf for inifinite rlimits
Date: Thu, 7 Dec 2017 23:18:54 +0100 [thread overview]
Message-ID: <20171207221854.21242-1-ncopa@alpinelinux.org> (raw)
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
next reply other threads:[~2017-12-07 22:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 22:18 Natanael Copa [this message]
2017-12-15 2:28 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171207221854.21242-1-ncopa@alpinelinux.org \
--to=ncopa@alpinelinux.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).