Merge pull request #1654 from mnottale/rlimit-stack-infinity
Handle RLIMIT_STACK set to infinity.
This commit is contained in:
commit
365e399036
1 changed files with 6 additions and 0 deletions
|
|
@ -58,9 +58,15 @@ unsigned long PlatformUtils::stackLimit()
|
|||
|
||||
int ret = getrlimit(RLIMIT_STACK, &limit);
|
||||
if (ret == 0) {
|
||||
if (limit.rlim_cur == RLIM_INFINITY) {
|
||||
return STACK_LIMIT_DEFAULT;
|
||||
}
|
||||
if (limit.rlim_cur > STACK_BUFFER_SIZE) {
|
||||
return limit.rlim_cur - STACK_BUFFER_SIZE;
|
||||
}
|
||||
if (limit.rlim_max == RLIM_INFINITY) {
|
||||
return STACK_LIMIT_DEFAULT;
|
||||
}
|
||||
if (limit.rlim_max > STACK_BUFFER_SIZE) {
|
||||
return limit.rlim_max - STACK_BUFFER_SIZE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue