Skip to content

Commit 67e2baf

Browse files
committed
cgroup: Parse infinity properly for memory protections
This fixes commit db2b8d2 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: systemd#16248
1 parent f83803a commit 67e2baf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/core/load-fragment.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3427,13 +3427,12 @@ int config_parse_memory_limit(
34273427
uint64_t bytes = CGROUP_LIMIT_MAX;
34283428
int r;
34293429

3430-
if (STR_IN_SET(lvalue, "DefaultMemoryLow",
3431-
"DefaultMemoryMin",
3432-
"MemoryLow",
3433-
"MemoryMin"))
3430+
if (isempty(rvalue) && STR_IN_SET(lvalue, "DefaultMemoryLow",
3431+
"DefaultMemoryMin",
3432+
"MemoryLow",
3433+
"MemoryMin"))
34343434
bytes = CGROUP_LIMIT_MIN;
3435-
3436-
if (!isempty(rvalue) && !streq(rvalue, "infinity")) {
3435+
else if (!isempty(rvalue) && !streq(rvalue, "infinity")) {
34373436

34383437
r = parse_permille(rvalue);
34393438
if (r < 0) {

0 commit comments

Comments
 (0)