chiark / gitweb /
journal-remote: fix handling of non-blocking sources
[elogind.git] / src / sysv-generator / sysv-generator.c
index 6c3281ff1520dcf470fc2366dba47a0b86ac30a9..43bcaa862fb5c15df767bb7e67461f47754451a9 100644 (file)
@@ -114,9 +114,9 @@ static int add_symlink(const char *service, const char *where) {
 }
 
 static int generate_unit_file(SysvStub *s) {
-        char *unit;
         char **p;
         _cleanup_fclose_ FILE *f = NULL;
+        _cleanup_free_ char *unit = NULL;
         _cleanup_free_ char *before = NULL;
         _cleanup_free_ char *after = NULL;
         _cleanup_free_ char *wants = NULL;
@@ -810,9 +810,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
                                         goto finish;
                                 }
 
-                                if (hashmap_contains(all_services, name))
-                                        service = hashmap_get(all_services, name);
-                                else {
+                                service = hashmap_get(all_services, name);
+                                if (!service){
                                         log_warning("Could not find init script for %s", name);
                                         continue;
                                 }