mirror of
https://github.com/troglobit/finit.git
synced 2026-10-05 15:23:31 +07:00
service_step(): Fix problem with double start of service/run/tasks
Make svc state transition to RUNNING *before* service_start(), because in that function we may call service_step() as well, which would start the svc again (since it was still in READY). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+8
-3
@@ -888,16 +888,21 @@ restart:
|
||||
if (sm_is_in_teardown(&sm))
|
||||
break;
|
||||
|
||||
/*
|
||||
* Make state transition *before* service_start(), because
|
||||
* of HOOK_SVC_START, which may call service_step()
|
||||
*/
|
||||
svc_mark_clean(svc);
|
||||
svc_set_state(svc, SVC_RUNNING_STATE);
|
||||
|
||||
err = service_start(svc);
|
||||
if (err) {
|
||||
(*restart_cnt)++;
|
||||
svc_set_state(svc, SVC_READY_STATE);
|
||||
|
||||
if (!svc_is_inetd_conn(svc))
|
||||
break;
|
||||
}
|
||||
|
||||
svc_mark_clean(svc);
|
||||
svc_set_state(svc, SVC_RUNNING_STATE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user