Fix prlimit error message

PiperOrigin-RevId: 248491089
Change-Id: Id4116939d02b6a592c74218955675acf2e3c70fe
This commit is contained in:
Wiktor Garbacz 2019-05-16 02:24:38 -07:00 committed by Copybara-Service
parent 7294e9976e
commit 6e1c3c3055

View File

@ -504,18 +504,17 @@ bool Monitor::InitApplyLimit(pid_t pid, __rlimit_resource resource,
rlimit64 curr_limit; rlimit64 curr_limit;
if (prlimit64(pid, resource, nullptr, &curr_limit) == -1) { if (prlimit64(pid, resource, nullptr, &curr_limit) == -1) {
PLOG(ERROR) << "prlimit64(" << pid << ", " << rlim_name << ")"; PLOG(ERROR) << "prlimit64(" << pid << ", " << rlim_name << ")";
} else { } else if (rlim.rlim_cur > curr_limit.rlim_max) {
// In such case, don't update the limits, as it will fail. Just stick to the // In such case, don't update the limits, as it will fail. Just stick to the
// current ones (which are already lower than intended). // current ones (which are already lower than intended).
if (rlim.rlim_cur > curr_limit.rlim_max) { LOG(ERROR) << rlim_name << ": new.current > current.max (" << rlim.rlim_cur
LOG(ERROR) << rlim_name << ": new.current > current.max (" << " > " << curr_limit.rlim_max << "), skipping";
<< rlim.rlim_cur << " > " << curr_limit.rlim_max return true;
<< "), skipping";
return true;
}
} }
if (prlimit64(pid, resource, &rlim, nullptr) == -1) { if (prlimit64(pid, resource, &rlim, nullptr) == -1) {
PLOG(ERROR) << "prlimit64(RLIMIT_AS, " << rlim.rlim_cur << ")"; PLOG(ERROR) << "prlimit64(" << pid << ", " << rlim_name << ", "
<< rlim.rlim_cur << ")";
return false; return false;
} }