Am 26.11.2014 um 23:39 schrieb Michael Biebl:
> diff --git a/src/sysv-generator/sysv-generator.c 
> b/src/sysv-generator/sysv-generator.c
> index 677fac4..da6b4f6 100644
> --- a/src/sysv-generator/sysv-generator.c
> +++ b/src/sysv-generator/sysv-generator.c
> @@ -768,6 +768,10 @@ static int enumerate_sysv(LookupPaths lp, Hashmap 
> *all_services) {
>                          service->name = name;
>                          service->path = fpath;
>  
> +                        r = load_sysv(service);
> +                        if (r < 0)
> +                                continue;
> +
>                          r = hashmap_put(all_services, service->name, 
> service);
>                          if (r < 0)
>                                  return log_oom();
> @@ -960,10 +964,6 @@ int main(int argc, char *argv[]) {
>          }
>  
>          HASHMAP_FOREACH(service, all_services, j) {
> -                q = load_sysv(service);
> -                if (q < 0)
> -                        continue;
> -
>                  q = fix_order(service, all_services);
>                  if (q < 0)
>                          continue;

To provide a more detailed explanation of the patch:
If a service fails to load, we skip fix_order(), which is results in the
wrong ordering.

So instead, just don't add a service to the all_services hash_map, if it
fails to load.


Uoti has a developed his own, more elaborate patch, which handles this a
bit differently and actually adds orderings against such non-existent
services. I don't think we actually need that and it doesn't make a
difference in practice. I've attached Uoti's patch for completeness sake.

Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 677fac4..fdd1a7c 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -87,6 +87,7 @@ typedef struct SysvStub {
         char **conflicts;
         bool has_lsb;
         bool reload;
+        bool loaded_ok;
 } SysvStub;
 
 const char *arg_dest = "/tmp";
@@ -961,7 +962,11 @@ int main(int argc, char *argv[]) {
 
         HASHMAP_FOREACH(service, all_services, j) {
                 q = load_sysv(service);
-                if (q < 0)
+                service->loaded_ok = q >= 0;
+        }
+
+        HASHMAP_FOREACH(service, all_services, j) {
+                if (!service->loaded_ok)
                         continue;
 
                 q = fix_order(service, all_services);

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to