summaryrefslogtreecommitdiff
path: root/src/conf/sysconf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-04-15 18:05:30 -0400
committerRich Felker <dalias@aerifal.cx>2014-04-15 18:05:30 -0400
commit6cf7d17f5349df9ee4a2d8c8c7c5d01c18385e08 (patch)
treef5ff141f683c0c7d987a4137c439512725c91dad /src/conf/sysconf.c
parent233767b48a083f526557ee39aa1c773efa345972 (diff)
downloadmusl-6cf7d17f5349df9ee4a2d8c8c7c5d01c18385e08.tar.gz
in sysconf, use getrlimit function rather than raw syscall for rlimits
the syscall is deprecated (replaced by prlimit64) and does not work correctly on x32. this change mildly increases size, but is likely needed anyway for newer archs that might omit deprecated syscalls.
Diffstat (limited to 'src/conf/sysconf.c')
-rw-r--r--src/conf/sysconf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/conf/sysconf.c b/src/conf/sysconf.c
index e225c3dd..9ac52a10 100644
--- a/src/conf/sysconf.c
+++ b/src/conf/sysconf.c
@@ -228,9 +228,9 @@ long sysconf(int name)
} else if (values[name] >= -1) {
return values[name];
} else if (values[name] < -256) {
- long lim[2];
- __syscall(SYS_getrlimit, values[name]&16383, lim);
- return lim[0] < 0 ? LONG_MAX : lim[0];
+ struct rlimit lim;
+ getrlimit(values[name]&16383, &lim);
+ return lim.rlim_cur > LONG_MAX ? LONG_MAX : lim.rlim_cur;
}
switch ((unsigned char)values[name]) {