about summary refs log tree commit diff
path: root/src/conf
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-12-07 23:18:54 +0100
committerRich Felker <dalias@aerifal.cx>2017-12-14 21:25:10 -0500
commit3ec82877e7783f0706ba3c9e3c815cd2aa34059e (patch)
treed57b3716980774d2e15a42a48a1dea670e324c56 /src/conf
parent131276809fe3b7bed6086772bc5e3e9941dc6c6c (diff)
downloadmusl-3ec82877e7783f0706ba3c9e3c815cd2aa34059e.tar.gz
musl-3ec82877e7783f0706ba3c9e3c815cd2aa34059e.tar.xz
musl-3ec82877e7783f0706ba3c9e3c815cd2aa34059e.zip
fix sysconf for infinite rlimits
sysconf should return -1 for infinity, not LONG_MAX.
Diffstat (limited to 'src/conf')
-rw-r--r--src/conf/sysconf.c2
1 files changed, 2 insertions, 0 deletions
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;
 	}