chiark / gitweb /
rework config file load logic
[elogind.git] / unit.c
diff --git a/unit.c b/unit.c
index e6e5574312161668f8b7133010cd815bc2267d85..40761209202455c2efe3056843f077c84771c83a 100644 (file)
--- a/unit.c
+++ b/unit.c
@@ -62,6 +62,9 @@ bool unit_name_is_valid(const char *n) {
         if (!(e = strrchr(n, '.')))
                 return false;
 
+        if (e == n)
+                return false;
+
         for (i = n; i < e; i++)
                 if (!strchr(VALID_CHARS, *i))
                         return false;
@@ -240,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;
@@ -368,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);
 
@@ -376,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) {