mirror of
https://github.com/troglobit/finit.git
synced 2026-11-14 19:03:16 +00:00
run stanzas are never caught in service_monitor()
A run stanza blocks operation by calling waitpid(), so it will never be caught by the service_monitor() function. Hence, we need to clean up any bootsrap calls after waitpid(), or at least perform a manual state change. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
29822ef0f7
commit
9e7e92b4b7
1 file changed
+5
-1
+5
-1
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#define RESPAWN_MAX 10 /* Prevent endless respawn of faulty services. */
|
#define RESPAWN_MAX 10 /* Prevent endless respawn of faulty services. */
|
||||||
|
|
||||||
|
static void svc_set_state(svc_t *svc, svc_state_t new);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* service_enabled - Should the service run?
|
* service_enabled - Should the service run?
|
||||||
@@ -311,7 +312,10 @@ static int service_start(svc_t *svc)
|
|||||||
|
|
||||||
if (SVC_TYPE_RUN == svc->type) {
|
if (SVC_TYPE_RUN == svc->type) {
|
||||||
result = WEXITSTATUS(complete(svc->cmd, pid));
|
result = WEXITSTATUS(complete(svc->cmd, pid));
|
||||||
svc->pid = 0;
|
if (!svc_clean_bootstrap(svc)) {
|
||||||
|
svc->pid = 0;
|
||||||
|
svc_set_state(svc, SVC_STOPPING_STATE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||||
|
|||||||
Reference in new issue
Block a user