summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-09-19 20:09:27 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-19 20:09:59 +0200
commit93e4c84bb3d6169a02a5ddd1cd0690ad64d20cd8 (patch)
treee79d1141bcfee1e03dacff1745608bed4db19c5b /src
parentcd8651982b497a8be369e0dbc24fe04ec5e83aaa (diff)
path: support specifier resolvin in .path units
Diffstat (limited to 'src')
-rw-r--r--src/core/load-fragment.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 0d5d841429..93f051af47 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -186,7 +186,7 @@ int config_parse_unit_path_printf(
k = unit_full_printf(u, rvalue);
if (!k)
- return -ENOMEM;
+ return log_oom();
r = config_parse_path(filename, line, section, lvalue, ltype, k, data, userdata);
free(k);
@@ -1193,32 +1193,36 @@ int config_parse_path_spec(
Path *p = data;
PathSpec *s;
PathType b;
+ char *k;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
- if ((b = path_type_from_string(lvalue)) < 0) {
+ b = path_type_from_string(lvalue);
+ if (b < 0) {
log_error("[%s:%u] Failed to parse path type, ignoring: %s", filename, line, lvalue);
return 0;
}
- if (!path_is_absolute(rvalue)) {
- log_error("[%s:%u] Path is not absolute, ignoring: %s", filename, line, rvalue);
+ k = unit_full_printf(UNIT(p), rvalue);
+ if (!k)
+ return log_oom();
+
+ if (!path_is_absolute(k)) {
+ log_error("[%s:%u] Path is not absolute, ignoring: %s", filename, line, k);
+ free(k);
return 0;
}
- if (!(s = new0(PathSpec, 1)))
- return -ENOMEM;
-
- if (!(s->path = strdup(rvalue))) {
- free(s);
- return -ENOMEM;
+ s = new0(PathSpec, 1);
+ if (!s) {
+ free(k);
+ return log_oom();
}
- path_kill_slashes(s->path);
-
+ s->path = path_kill_slashes(k);
s->type = b;
s->inotify_fd = -1;