LibCore: Respect system hard limit in set_resource_limits
This avoids an "Invalid argument (errno=22)" error on systems with lower hard limits.
This commit is contained in:
parent
c5a54f1166
commit
c97af00355
Notes:
github-actions[bot]
2024-10-27 20:16:33 +00:00
Author: https://github.com/yyny Commit: https://github.com/LadybirdBrowser/ladybird/commit/c97af003551 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2006
1 changed files with 1 additions and 1 deletions
|
@ -992,7 +992,7 @@ ErrorOr<rlimit> get_resource_limits(int resource)
|
|||
ErrorOr<void> set_resource_limits(int resource, rlim_t limit)
|
||||
{
|
||||
auto limits = TRY(get_resource_limits(resource));
|
||||
limits.rlim_cur = limit;
|
||||
limits.rlim_cur = min(limit, limits.rlim_max);
|
||||
|
||||
if (::setrlimit(resource, &limits) != 0)
|
||||
return Error::from_syscall("setrlimit"sv, -errno);
|
||||
|
|
Loading…
Add table
Reference in a new issue