getdtablesize: fix returning hard instead of soft rlimit

This makes the result consistent with sysconf(_SC_OPEN_MAX).
This commit is contained in:
Olivier Brunel 2016-08-13 20:31:49 +02:00 committed by Rich Felker
parent c1f4ed1501
commit 397586625e

View File

@ -7,5 +7,5 @@ int getdtablesize(void)
{
struct rlimit rl;
getrlimit(RLIMIT_NOFILE, &rl);
return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX;
return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX;
}