core: resolve specifier in config_parse_exec()

When parse ExecXXX=, specifiers are not resolved in
config_parse_exec(). Finally, the specifiers are set into unit
properties. So, systemctl shows not resolved speicifier on "Process:"
field.
To set the exec properties well, resolve specifiers before parse the
rvale by unit_full_printf();
This commit is contained in:
WaLyong Cho 2016-01-12 13:40:20 +09:00
parent f466acdc63
commit cb48dfca6a

View file

@ -574,7 +574,9 @@ int config_parse_exec(
void *data,
void *userdata) {
_cleanup_free_ char *cmd = NULL;
ExecCommand **e = data;
Unit *u = userdata;
const char *p;
bool semicolon;
int r;
@ -583,6 +585,7 @@ int config_parse_exec(
assert(lvalue);
assert(rvalue);
assert(e);
assert(u);
e += ltype;
rvalue += strspn(rvalue, WHITESPACE);
@ -593,7 +596,13 @@ int config_parse_exec(
return 0;
}
p = rvalue;
r = unit_full_printf(u, rvalue, &cmd);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers on %s, ignoring: %m", rvalue);
return 0;
}
p = cmd;
do {
_cleanup_free_ char *path = NULL, *firstword = NULL;
bool separate_argv0 = false, ignore = false;