X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsysv-generator%2Fsysv-generator.c;h=43bcaa862fb5c15df767bb7e67461f47754451a9;hb=56a7dd42d3a680691f417bd8a4c46ea1b6283ff5;hp=368d420df3bb450dd59645cb0e6f9a2cfa512231;hpb=b2fadec6048adb3596f2633cb7fe7a49f5937a18;p=elogind.git diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index 368d420df..43bcaa862 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -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; } @@ -824,8 +823,7 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) { MAX(a*10 + b, service->sysv_start_priority); } - r = set_ensure_allocated(&runlevel_services[i], - trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&runlevel_services[i], NULL); if (r < 0) goto finish; @@ -836,8 +834,7 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) { } else if (de->d_name[0] == 'K' && (rcnd_table[i].type == RUNLEVEL_DOWN)) { - r = set_ensure_allocated(&shutdown_services, - trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&shutdown_services, NULL); if (r < 0) goto finish; @@ -905,7 +902,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - all_services = hashmap_new(string_hash_func, string_compare_func); + all_services = hashmap_new(&string_hash_ops); if (!all_services) { log_oom(); return EXIT_FAILURE;