LibCore: Use Error::from_syscall to report get/setrlimit errors

(cherry picked from commit 9e7e22dc74ff1bb99e0e8dff63128ef087623480)
This commit is contained in:
Timothy Flynn 2024-07-31 10:15:46 -04:00 committed by Nico Weber
parent 736c931a15
commit 5d70ea62db

View file

@ -1891,7 +1891,7 @@ ErrorOr<rlimit> get_resource_limits(int resource)
rlimit limits;
if (::getrlimit(resource, &limits) != 0)
return Error::from_errno(errno);
return Error::from_syscall("getrlimit"sv, -errno);
return limits;
}
@ -1902,7 +1902,7 @@ ErrorOr<void> set_resource_limits(int resource, rlim_t limit)
limits.rlim_cur = limit;
if (::setrlimit(resource, &limits) != 0)
return Error::from_errno(errno);
return Error::from_syscall("setrlimit"sv, -errno);
return {};
}