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 17:32:08 +09:00
parent f466acdc63
commit cb48dfca6a
+10 -1
View File
@@ -574,7 +574,9 @@ int config_parse_exec(
void *data, void *data,
void *userdata) { void *userdata) {
_cleanup_free_ char *cmd = NULL;
ExecCommand **e = data; ExecCommand **e = data;
Unit *u = userdata;
const char *p; const char *p;
bool semicolon; bool semicolon;
int r; int r;
@@ -583,6 +585,7 @@ int config_parse_exec(
assert(lvalue); assert(lvalue);
assert(rvalue); assert(rvalue);
assert(e); assert(e);
assert(u);
e += ltype; e += ltype;
rvalue += strspn(rvalue, WHITESPACE); rvalue += strspn(rvalue, WHITESPACE);
@@ -593,7 +596,13 @@ int config_parse_exec(
return 0; 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 { do {
_cleanup_free_ char *path = NULL, *firstword = NULL; _cleanup_free_ char *path = NULL, *firstword = NULL;
bool separate_argv0 = false, ignore = false; bool separate_argv0 = false, ignore = false;