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:
parent
8357640d63
commit
87e6718233
@ -37,7 +37,7 @@ getdtablesize(void)
|
|||||||
{
|
{
|
||||||
struct rlimit rlimit;
|
struct rlimit rlimit;
|
||||||
if (getrlimit(RLIMIT_NOFILE, &rlimit) < 0)
|
if (getrlimit(RLIMIT_NOFILE, &rlimit) < 0)
|
||||||
return 0;
|
return OPEN_MAX;
|
||||||
|
|
||||||
return rlimit.rlim_cur;
|
return rlimit.rlim_cur;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ __sysconf(int name)
|
|||||||
case _SC_NGROUPS_MAX:
|
case _SC_NGROUPS_MAX:
|
||||||
return NGROUPS_MAX;
|
return NGROUPS_MAX;
|
||||||
case _SC_OPEN_MAX:
|
case _SC_OPEN_MAX:
|
||||||
return OPEN_MAX;
|
return getdtablesize();
|
||||||
case _SC_SAVED_IDS:
|
case _SC_SAVED_IDS:
|
||||||
return 1;
|
return 1;
|
||||||
case _SC_STREAM_MAX:
|
case _SC_STREAM_MAX:
|
||||||
|
Loading…
Reference in New Issue
Block a user