X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fservice.c;h=4dcd306009788cbd8962009b707fcfa2e5d6fda4;hb=3e52541ef51b1004357fbcd4bf863fb955ab83e9;hp=a84cee16af9e7e06811ce8d89d52fabeea3cc5ea;hpb=1124fe6f01b1d59d016c238026f20380f38d98dc;p=elogind.git diff --git a/src/service.c b/src/service.c index a84cee16a..4dcd30600 100644 --- a/src/service.c +++ b/src/service.c @@ -147,6 +147,17 @@ static void service_unwatch_main_pid(Service *s) { s->main_pid = 0; } +static void service_unwatch_pid_file(Service *s) { + if (!s->pid_file_pathspec) + return; + + log_debug("Stopping watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path); + path_spec_unwatch(s->pid_file_pathspec, UNIT(s)); + path_spec_done(s->pid_file_pathspec); + free(s->pid_file_pathspec); + s->pid_file_pathspec = NULL; +} + static int service_set_main_pid(Service *s, pid_t pid) { pid_t ppid; @@ -222,6 +233,7 @@ static void service_done(Unit *u) { * our resources */ service_unwatch_main_pid(s); service_unwatch_control_pid(s); + service_unwatch_pid_file(s); if (s->bus_name) { unit_unwatch_bus_name(u, s->bus_name); @@ -376,7 +388,7 @@ static int sysv_fix_order(Service *s) { UnitDependency d; bool special_s, special_t; - t = (Service*) other; + t = SERVICE(other); if (s == t) continue; @@ -1023,7 +1035,7 @@ static int fsck_fix_order(Service *s) { Service *t; UnitDependency d; - t = (Service*) other; + t = SERVICE(other); if (s == t) continue; @@ -1389,17 +1401,6 @@ static void service_notify_sockets_dead(Service *s) { return; } -static void service_unwatch_pid_file(Service *s) { - if (!s->pid_file_pathspec) - return; - - log_debug("Stopping watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path); - path_spec_unwatch(s->pid_file_pathspec, UNIT(s)); - path_spec_done(s->pid_file_pathspec); - free(s->pid_file_pathspec); - s->pid_file_pathspec = NULL; -} - static void service_set_state(Service *s, ServiceState state) { ServiceState old_state; assert(s);