summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-05 19:40:13 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-07 18:47:32 +0100
commit744bb5b1bea4d04363f7894e86701efdd75b8acb (patch)
tree15ecc788825874f6667df523bbb5d2b5be9cfda5 /src/core
parentd107589cd2767c95fb1c794d4f90832301a297f5 (diff)
core: add specifier expansion to RequiresMountsFor=
This might be useful for some people, for example to pull in mounts for paths including the machine ID or hostname.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/load-fragment.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 3ffb417f97..85bac9ea5b 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2565,7 +2565,7 @@ int config_parse_unit_requires_mounts_for(
assert(data);
for (p = rvalue;; ) {
- _cleanup_free_ char *word = NULL;
+ _cleanup_free_ char *word = NULL, *resolved = NULL;
r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
if (r == 0)
@@ -2583,9 +2583,15 @@ int config_parse_unit_requires_mounts_for(
continue;
}
- r = unit_require_mounts_for(u, word);
+ r = unit_full_printf(u, word, &resolved);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit name \"%s\", ignoring: %m", word);
+ continue;
+ }
+
+ r = unit_require_mounts_for(u, resolved);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to add required mount \"%s\", ignoring: %m", word);
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to add required mount \"%s\", ignoring: %m", resolved);
continue;
}
}