mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 00:56:39 +00:00
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: c97af00355
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)
|
ErrorOr<void> set_resource_limits(int resource, rlim_t limit)
|
||||||
{
|
{
|
||||||
auto limits = TRY(get_resource_limits(resource));
|
auto limits = TRY(get_resource_limits(resource));
|
||||||
limits.rlim_cur = limit;
|
limits.rlim_cur = min(limit, limits.rlim_max);
|
||||||
|
|
||||||
if (::setrlimit(resource, &limits) != 0)
|
if (::setrlimit(resource, &limits) != 0)
|
||||||
return Error::from_syscall("setrlimit"sv, -errno);
|
return Error::from_syscall("setrlimit"sv, -errno);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue