X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fsysv-generator%2Fsysv-generator.c;h=6e4cdd694e5a877957d8e7bb980e531eea861ab0;hp=cfae1d75b3b2ece288ba0a87c239c8847e498e47;hb=cf4acf84c6304d34108dadd5e87c9a19ca24dceb;hpb=a2a5291b3f5ab6ed4c92f51d0fd10a03047380d8 diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index cfae1d75b..6e4cdd694 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -31,7 +31,6 @@ #include "path-util.h" #include "path-lookup.h" #include "log.h" -#include "strv.h" #include "unit.h" #include "unit-name.h" #include "special.h" @@ -114,9 +113,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; @@ -494,6 +493,10 @@ static int load_sysv(SysvStub *s) { "[%s:%u] Failed to add LSB Provides name %s, ignoring: %s", s->path, line, m, strerror(-r)); } + if (!isempty(state_)) + log_error_unit(s->name, + "[%s:%u] Trailing garbage in Provides, ignoring.", + s->path, line); } else if (startswith_no_case(t, "Required-Start:") || startswith_no_case(t, "Should-Start:") || @@ -552,6 +555,11 @@ static int load_sysv(SysvStub *s) { "[%s:%u] Failed to add dependency on %s, ignoring: %s", s->path, line, m, strerror(-r)); } + if (!isempty(state_)) + log_error_unit(s->name, + "[%s:%u] Trailing garbage in %*s, ignoring.", + s->path, line, + (int)(strchr(t, ':') - t), t); } else if (startswith_no_case(t, "Description:")) { char *d, *j; @@ -801,9 +809,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; } @@ -815,8 +822,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; @@ -827,8 +833,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; @@ -896,7 +901,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;