diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-20 19:15:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-20 19:15:04 +0200 |
commit | 8c710f3ce64110a4cfe977116c55bd87777e641c (patch) | |
tree | 4ccb2927b125e8df538bca6fbfa59a54f707161e /src | |
parent | 4b8b34855eaffdcf4a6ee462d93dec17faf08f93 (diff) | |
parent | 9b5864d9d97bd1f1ba7a2010c8f0b679fb0d0d58 (diff) |
Merge pull request #1292 from gebi/resolve-specifier-in-runtime-directory
load-fragment: resolve specifiers in RuntimeDirectory
Diffstat (limited to 'src')
-rw-r--r-- | src/core/load-fragment.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 1217b4651e..fcf863c5c7 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3049,6 +3049,7 @@ int config_parse_runtime_directory( void *userdata) { char***rt = data; + Unit *u = userdata; const char *word, *state; size_t l; int r; @@ -3065,12 +3066,19 @@ int config_parse_runtime_directory( } FOREACH_WORD_QUOTED(word, l, rvalue, state) { - _cleanup_free_ char *n; + _cleanup_free_ char *t = NULL, *n = NULL; - n = strndup(word, l); - if (!n) + t = strndup(word, l); + if (!t) return log_oom(); + r = unit_name_printf(u, t, &n); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, -r, + "Failed to resolve specifiers, ignoring: %s", strerror(-r)); + continue; + } + if (!filename_is_valid(n)) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Runtime directory is not valid, ignoring assignment: %s", rvalue); |