commit 4318accbfe035a9970fc14458cee305f0c7d788f Author: Michael Gebetsroither Date: Thu Sep 17 22:54:13 2015 +0200 load-fragment: resolve specifiers in RuntimeDirectory diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index a48cb40..372e090 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3068,6 +3068,7 @@ int config_parse_runtime_directory( void *userdata) { char***rt = data; + Unit *u = userdata; const char *word, *state; size_t l; int r; @@ -3085,12 +3086,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);