X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=unit.c;h=a5f4ac76767d1c412db7d166b7d62a3559d860d3;hb=b19e7dc0104c8839835a90d7df20c2eeb631e07e;hp=e8d61c853c51529c3fb2b9c4f0917b833632bd73;hpb=48e11fe8805bf1fcaa9d6231a037eed9cc931a62;p=elogind.git diff --git a/unit.c b/unit.c index e8d61c853..a5f4ac767 100644 --- a/unit.c +++ b/unit.c @@ -243,7 +243,8 @@ static int ensure_merge(Set **s, Set *other) { return 0; } -/* FIXME: Does not rollback on failure! */ +/* FIXME: Does not rollback on failure! Needs to fix special unit + * pointers. Needs to merge names and dependencies properly.*/ int unit_merge(Unit *u, Unit *other) { int r; UnitDependency d; @@ -371,7 +372,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { /* Common implementation for multiple backends */ int unit_load_fragment_and_dropin(Unit *u) { - int r; + int r, ret; assert(u); @@ -379,11 +380,13 @@ int unit_load_fragment_and_dropin(Unit *u) { if ((r = unit_load_fragment(u)) < 0) return r; + ret = r > 0; + /* Load drop-in directory data */ if ((r = unit_load_dropin(u)) < 0) return r; - return 0; + return ret; } int unit_load(Unit *u) { @@ -833,6 +836,19 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other) { return 0; } +int unit_add_dependency_by_name(Unit *u, UnitDependency d, const char *name) { + Unit *other; + int r; + + if ((r = manager_load_unit(u->meta.manager, name, &other)) < 0) + return r; + + if ((r = unit_add_dependency(u, d, other)) < 0) + return r; + + return 0; +} + const char *unit_path(void) { char *e;