mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibCore: Respect system hard limit in set_resource_limits
This avoids an "Invalid argument (errno=22)" error on systems with lower hard limits. (cherry picked from commit c97af00355159b0dac9019b885af7c6016e75dc7)
This commit is contained in:
parent
de1ecc17ce
commit
095c076941
1 changed files with 1 additions and 1 deletions
|
@ -1907,7 +1907,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