POSIX: have sysconf(_SC_OPEN_MAX) return the rlimit value.

* we use this value in posix_spawn_file_actions_adddup2() for instance, ninja then
fails with "Bad file descriptor".
This commit is contained in:
Jérôme Duval 2017-11-01 13:02:53 +01:00
parent 8357640d63
commit 87e6718233

View File

@ -37,7 +37,7 @@ getdtablesize(void)
{
struct rlimit rlimit;
if (getrlimit(RLIMIT_NOFILE, &rlimit) < 0)
return 0;
return OPEN_MAX;
return rlimit.rlim_cur;
}
@ -74,7 +74,7 @@ __sysconf(int name)
case _SC_NGROUPS_MAX:
return NGROUPS_MAX;
case _SC_OPEN_MAX:
return OPEN_MAX;
return getdtablesize();
case _SC_SAVED_IDS:
return 1;
case _SC_STREAM_MAX: