From: Davin McCall Date: Tue, 29 Dec 2015 09:16:40 +0000 (+0000) Subject: Prevent force_stop state being set in a service that has already X-Git-Tag: v0.01~93 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c16fc19039957b3525e966b35c9f54814fe6d7c9;p=oweals%2Fdinit.git Prevent force_stop state being set in a service that has already stopped. --- 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; }