fix sysconf for infinite rlimits

sysconf should return -1 for infinity, not LONG_MAX.
This commit is contained in:
Natanael Copa 2017-12-07 23:18:54 +01:00 committed by Rich Felker
parent 131276809f
commit 3ec82877e7
1 changed files with 2 additions and 0 deletions

View File

@ -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;
}