chiark / gitweb /
logger: fix return value
[elogind.git] / unit.c
diff --git a/unit.c b/unit.c
index 673aac184f671a5ca5767f4e166afb787bc1a7d8..036c01648c6e017ee4d832e67d74a20e1c359fe9 100644 (file)
--- a/unit.c
+++ b/unit.c
@@ -978,6 +978,19 @@ int unit_add_dependency_by_name(Unit *u, UnitDependency d, const char *name) {
         return 0;
 }
 
+int unit_add_dependency_by_name_inverse(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(other, d, u)) < 0)
+                return r;
+
+        return 0;
+}
+
 int set_unit_path(const char *p) {
         char *cwd, *c;
         int r;