summaryrefslogtreecommitdiff
path: root/manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'manager.c')
-rw-r--r--manager.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/manager.c b/manager.c
index 819164ca2d..682c7e7f26 100644
--- a/manager.c
+++ b/manager.c
@@ -830,16 +830,19 @@ static void dispatch_load_queue(Manager *m) {
m->dispatching_load_queue = false;
}
-int manager_load_unit(Manager *m, const char *name, Unit **_ret) {
+int manager_load_unit(Manager *m, const char *path, Unit **_ret) {
Unit *ret;
int r;
+ const char *name;
assert(m);
- assert(name);
+ assert(path);
assert(_ret);
/* This will load the service information files, but not actually
- * start any services or anything */
+ * start any services or anything. */
+
+ name = file_name_from_path(path);
if ((ret = manager_get_unit(m, name))) {
*_ret = ret;
@@ -849,6 +852,13 @@ int manager_load_unit(Manager *m, const char *name, Unit **_ret) {
if (!(ret = unit_new(m)))
return -ENOMEM;
+ if (is_path(path)) {
+ if (!(ret->meta.load_path = strdup(path))) {
+ unit_free(ret);
+ return -ENOMEM;
+ }
+ }
+
if ((r = unit_add_name(ret, name)) < 0) {
unit_free(ret);
return r;