summaryrefslogtreecommitdiff
path: root/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-27 00:15:56 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-27 00:15:56 +0100
commit0301abf48ed3be921c33d409c73b554435cf6378 (patch)
treea519dad97ab1eb945be1999c2892aa2fe25509c3 /manager.c
parent87f0e418cf2c58b3201d06a60e3696ec672d2662 (diff)
implement drop-in directories
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;