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
1 changed files with 5 additions and 6 deletions

View File

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