cgroup: Parse infinity properly for memory protections

This fixes commit db2b8d2e28 that
rectified parsing empty values but broke parsing explicit infinity.
Intended parsing semantics will be captured in a testcase in a follow up
commit.

Ref: #16248
This commit is contained in:
Michal Koutný 2020-06-24 20:40:02 +02:00
parent f83803a649
commit 67e2baff6b

View file

@ -3427,13 +3427,12 @@ int config_parse_memory_limit(
uint64_t bytes = CGROUP_LIMIT_MAX; uint64_t bytes = CGROUP_LIMIT_MAX;
int r; int r;
if (STR_IN_SET(lvalue, "DefaultMemoryLow", if (isempty(rvalue) && STR_IN_SET(lvalue, "DefaultMemoryLow",
"DefaultMemoryMin", "DefaultMemoryMin",
"MemoryLow", "MemoryLow",
"MemoryMin")) "MemoryMin"))
bytes = CGROUP_LIMIT_MIN; bytes = CGROUP_LIMIT_MIN;
else if (!isempty(rvalue) && !streq(rvalue, "infinity")) {
if (!isempty(rvalue) && !streq(rvalue, "infinity")) {
r = parse_permille(rvalue); r = parse_permille(rvalue);
if (r < 0) { if (r < 0) {