mirror of
https://github.com/troglobit/finit.git
synced 2026-10-29 12:40:44 +00: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:
1 parent
594476c4fc
commit
e841984a4e
1 file changed
+8
-3
+8
-3
@@ -888,16 +888,21 @@ restart:
|
|||||||
if (sm_is_in_teardown(&sm))
|
if (sm_is_in_teardown(&sm))
|
||||||
break;
|
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);
|
err = service_start(svc);
|
||||||
if (err) {
|
if (err) {
|
||||||
(*restart_cnt)++;
|
(*restart_cnt)++;
|
||||||
|
svc_set_state(svc, SVC_READY_STATE);
|
||||||
|
|
||||||
if (!svc_is_inetd_conn(svc))
|
if (!svc_is_inetd_conn(svc))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
svc_mark_clean(svc);
|
|
||||||
svc_set_state(svc, SVC_RUNNING_STATE);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user