]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: resolve specifier in config_parse_exec()
authorWaLyong Cho <walyong.cho@samsung.com>
Tue, 12 Jan 2016 04:40:20 +0000 (13:40 +0900)
committerWaLyong Cho <walyong.cho@samsung.com>
Tue, 12 Jan 2016 08:32:08 +0000 (17:32 +0900)
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();

src/core/load-fragment.c

index cb553e1252d32410dd360ab85f66f81ae76409b3..b961916ee0ff6af11e0da4807673349b1f74a92c 100644 (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;