chiark / gitweb /
vconsole-setup: ignore empty strings like FOO="", imported from config files
[elogind.git] / src / service.c
index 797f28577408e5adbce0409b1d5063bff6e00435..021bc86766978d0135f3d42b57e0dadec89231c6 100644 (file)
@@ -239,9 +239,9 @@ static char *sysv_translate_name(const char *name) {
                 /* Drop Debian-style .sh suffix */
                 strcpy(stpcpy(r, name) - 3, ".service");
 #ifdef TARGET_ARCH
-       else if (startswith(name, "@"))
-               /* Drop Arch-style background prefix */
-               strcpy(stpcpy(r, name + 1), ".service");
+        else if (startswith(name, "@"))
+                /* Drop Arch-style background prefix */
+                strcpy(stpcpy(r, name + 1), ".service");
 #endif
         else
                 /* Normal init scripts */
@@ -280,6 +280,10 @@ static int sysv_translate_facility(const char *name, char **_r) {
         unsigned i;
         char *r;
 
+        /* SuSE insserv extension */
+        if (streq(name, "$null"))
+                return 0;
+
         for (i = 0; i < ELEMENTSOF(table); i += 2)
                 if (streq(table[i], name)) {
                         if (!(r = strdup(table[i+1])))
@@ -289,6 +293,7 @@ static int sysv_translate_facility(const char *name, char **_r) {
                 }
 
         if (*name == '$')
+                /* This is a heuristic. */
                 r = unit_name_build(name+1, NULL, ".target");
         else
                 r = sysv_translate_name(name);
@@ -326,6 +331,9 @@ static int sysv_fix_order(Service *s) {
                 if (s == t)
                         continue;
 
+                if (t->meta.load_state != UNIT_LOADED)
+                        continue;
+
                 if (t->sysv_start_priority < 0)
                         continue;
 
@@ -578,6 +586,11 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                                 goto finish;
                                         }
 
+                                        if (streq(n, file_name_from_path(path))) {
+                                                free(n);
+                                                continue;
+                                        }
+
                                         r = sysv_translate_facility(n, &m);
                                         free(n);
 
@@ -623,6 +636,11 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                                 goto finish;
                                         }
 
+                                        if (streq(n, file_name_from_path(path))) {
+                                                free(n);
+                                                continue;
+                                        }
+
                                         r = sysv_translate_facility(n, &m);
                                         free(n);