service: only force stop dependents if necessary.
authorDavin McCall <davmac@davmac.org>
Fri, 9 Jun 2017 16:19:11 +0000 (17:19 +0100)
committerDavin McCall <davmac@davmac.org>
Fri, 9 Jun 2017 16:19:11 +0000 (17:19 +0100)
Only force-stop dependent services if this service is force-stopped.

src/service.cc

index 1ce35c83d6168e088988ea674717cae835ed7598..1b19770f2e53cb7511d4aee46cb9a23a411353af 100644 (file)
@@ -1083,7 +1083,12 @@ bool ServiceRecord::stopDependents() noexcept
             all_deps_stopped = false;
         }
 
-        (*i)->forceStop();
+        if (force_stop) {
+            // If this service is to be forcefully stopped, dependents must also be.
+            (*i)->forceStop();
+        }
+
+        (*i)->do_stop();
     }
 
     return all_deps_stopped;