diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-01-15 21:37:17 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-01-15 21:37:17 +0100 |
commit | 858c33bf6002bcdbea185ddedde8f8d660afc731 (patch) | |
tree | 6be10e929be5fad38bd2095502f546c2da723916 /src/core/load-fragment.c | |
parent | 7d0c710d72f8a6e5c6909c65700aa088c53aebc6 (diff) |
load-fragment: replace specifiers in path unit's Unit= setting
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 4d1154e408..d9f01a2fb6 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -1287,6 +1287,7 @@ int config_parse_path_unit( int r; DBusError error; Unit *u; + _cleanup_free_ char *p = NULL; assert(filename); assert(lvalue); @@ -1295,13 +1296,18 @@ int config_parse_path_unit( dbus_error_init(&error); - if (endswith(rvalue, ".path")) { - log_error("[%s:%u] Unit cannot be of type path, ignoring: %s", filename, line, rvalue); + p = unit_name_printf(u, rvalue); + if (!p) + return log_oom(); + + if (endswith(p, ".path")) { + log_error("[%s:%u] Unit cannot be of type path, ignoring: %s", filename, line, p); return 0; } - if ((r = manager_load_unit(UNIT(t)->manager, rvalue, NULL, &error, &u)) < 0) { - log_error("[%s:%u] Failed to load unit %s, ignoring: %s", filename, line, rvalue, bus_error(&error, r)); + r = manager_load_unit(UNIT(t)->manager, p, NULL, &error, &u); + if (r < 0) { + log_error("[%s:%u] Failed to load unit %s, ignoring: %s", filename, line, p, bus_error(&error, r)); dbus_error_free(&error); return 0; } |