X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fservice.c;h=121ddec6ad3b72e6c8f233c066bf89154ca70f74;hb=98b2f766b24c84fc49a4df954717b1f96bbce00d;hp=ca71788d220a55b40349025b65298237a7bb57a7;hpb=ef417cfd2211ae017a38b9796c6db29130133e63;p=elogind.git diff --git a/src/core/service.c b/src/core/service.c index ca71788d2..121ddec6a 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -147,9 +147,9 @@ static void service_init(Unit *u) { kill_context_init(&s->kill_context); cgroup_context_init(&s->cgroup_context); - RATELIMIT_INIT(s->start_limit, - u->manager->default_start_limit_interval, - u->manager->default_start_limit_burst); + unit_cgroup_context_init_defaults(u, &s->cgroup_context); + + RATELIMIT_INIT(s->start_limit, u->manager->default_start_limit_interval, u->manager->default_start_limit_burst); s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID; } @@ -1235,7 +1235,7 @@ static int service_load(Unit *u) { return r; } - r = unit_exec_context_defaults(u, &s->exec_context); + r = unit_exec_context_patch_defaults(u, &s->exec_context); if (r < 0) return r; } @@ -1436,9 +1436,7 @@ static int service_search_main_pid(Service *s) { log_warning_unit(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id); - return r; - - return 0; + return r; } static void service_set_state(Service *s, ServiceState state) { @@ -1772,6 +1770,7 @@ static int service_spawn( UNIT(s)->manager->confirm_spawn, UNIT(s)->manager->cgroup_supported, path, + manager_get_runtime_prefix(UNIT(s)->manager), UNIT(s)->id, s->watchdog_usec, s->type == SERVICE_IDLE ? UNIT(s)->manager->idle_pipe : NULL, @@ -1873,10 +1872,13 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) s->forbid_restart = false; - /* we want fresh tmpdirs in case service is started again immediately */ + /* We want fresh tmpdirs in case service is started again immediately */ exec_runtime_destroy(s->exec_runtime); s->exec_runtime = exec_runtime_unref(s->exec_runtime); + /* Also, remove the runtime directory in */ + exec_context_destroy_runtime_directory(&s->exec_context, manager_get_runtime_prefix(UNIT(s)->manager)); + /* Try to delete the pid file. At this point it will be * out-of-date, and some software might be confused by it, so * let's remove it. */