[systemd-commits] src/core
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Sep 19 11:10:10 PDT 2012
src/core/load-fragment.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
New commits:
commit 93e4c84bb3d6169a02a5ddd1cd0690ad64d20cd8
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Sep 19 20:09:27 2012 +0200
path: support specifier resolvin in .path units
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 0d5d841..93f051a 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;
More information about the systemd-commits
mailing list