If a "scripted" service has no stop command, allow it to stop immediately.
authorDavin McCall <davmac@davmac.org>
Sat, 2 Jan 2016 18:41:05 +0000 (18:41 +0000)
committerDavin McCall <davmac@davmac.org>
Sat, 2 Jan 2016 18:41:05 +0000 (18:41 +0000)
This allows no stop command to be specified if none is needed. (This probably
already worked, but only because Dinit would try to exec "" (the empty string)
when the service stopped, which would fail, and the service would get marked
as stopped anyway).

service.cc

index a2a5d8ec0b6f65c14b6603626ebfb0e6100d0faf..c60c22862e5b6f7efbb27f8f828627f1c13c643e 100644 (file)
@@ -621,7 +621,10 @@ void ServiceRecord::allDepsStopped()
     }
     else if (service_type == ServiceType::SCRIPTED) {
         // Scripted service.
-        if (! start_ps_process(stop_arg_parts, false)) {
+        if (stop_command.length() == 0) {
+            stopped();
+        }
+        else if (! start_ps_process(stop_arg_parts, false)) {
             // Couldn't execute stop script, but there's not much we can do:
             stopped();
         }