From c16fc19039957b3525e966b35c9f54814fe6d7c9 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Tue, 29 Dec 2015 09:16:40 +0000 Subject: [PATCH] Prevent force_stop state being set in a service that has already stopped. --- service.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/service.cc b/service.cc index 705bb44..2fa88e2 100644 --- a/service.cc +++ b/service.cc @@ -407,12 +407,15 @@ bool ServiceRecord::start_ps_process(const std::vector &pargs) noex // Mark this and all dependent services as force-stopped. void ServiceRecord::forceStop() noexcept { - force_stop = true; - stop(); - for (sr_iter i = dependents.begin(); i != dependents.end(); i++) { - (*i)->forceStop(); + if (service_state != ServiceState::STOPPED) { + force_stop = true; + for (sr_iter i = dependents.begin(); i != dependents.end(); i++) { + (*i)->forceStop(); + } + stop(); + + // We don't want to force stop soft dependencies, however. } - // We don't want to force stop soft dependencies, however. } // A dependency of this service failed to start. @@ -545,14 +548,12 @@ void ServiceRecord::allDepsStopped() void ServiceRecord::pinStart() noexcept { - pinned_stopped = false; start(); pinned_started = true; } void ServiceRecord::pinStop() noexcept { - pinned_started = false; stop(); pinned_stopped = true; } -- 2.25.1