load-fragment: parse specifiers in CPUAffinity= (#19281)

This commit is contained in:
Francois Gervais 2021-04-12 18:25:29 -04:00 committed by GitHub
parent 7c5fd25119
commit 54cfe9a75f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1698,6 +1698,8 @@ int config_parse_exec_cpu_affinity(
void *userdata) {
ExecContext *c = data;
const Unit *u = userdata;
_cleanup_free_ char *k = NULL;
int r;
assert(filename);
@ -1712,7 +1714,15 @@ int config_parse_exec_cpu_affinity(
return 0;
}
r = parse_cpu_set_extend(rvalue, &c->cpu_set, true, unit, filename, line, lvalue);
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to resolve unit specifiers in '%s', ignoring: %m",
rvalue);
return 0;
}
r = parse_cpu_set_extend(k, &c->cpu_set, true, unit, filename, line, lvalue);
if (r >= 0)
c->cpu_affinity_from_numa = false;