fd closes.
A smooth-recovery process should not reported started when it recovers
(state is already STARTED). Furthermore, a service could be stopped
during smooth recovery, in which case the state will be STOPPING and
the service should certainly not transition to STARTED.
else {
// exec() succeeded.
if (sr->service_type == ServiceType::PROCESS) {
- if (sr->service_state != ServiceState::STARTED) {
+ // This could be a smooth recovery (state already STARTED). Even more, the process
+ // might be stopped (and killed via a signal) during smooth recovery. We don't to
+ // process startup again in either case, so we check for state STARTING:
+ if (sr->service_state == ServiceState::STARTING) {
sr->started();
}
}