X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fservice.c;h=021bc86766978d0135f3d42b57e0dadec89231c6;hp=797f28577408e5adbce0409b1d5063bff6e00435;hb=915d22e4f09e8f6d7fb2e7a7456f8b5908bd7f98;hpb=07459bb6b92268beb2599f65cf195708d88c51cc diff --git a/src/service.c b/src/service.c index 797f28577..021bc8676 100644 --- a/src/service.c +++ b/src/service.c @@ -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);