From 4d29cd616632034e359ca4518065aea7d3a8fa55 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 13 May 2020 19:47:23 +0200 Subject: Minor cleanup Signed-off-by: David Oberhollenzer --- initd/main.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'initd') diff --git a/initd/main.c b/initd/main.c index b83beb3..26a04e2 100644 --- a/initd/main.c +++ b/initd/main.c @@ -136,7 +136,6 @@ int main(void) { svc_run_data_t *rt, *terminated; struct sigaction act; - service_t *svc; if (config_load()) return EXIT_FAILURE; @@ -158,14 +157,9 @@ int main(void) if (rt == NULL) { terminated = wait_for_process(); - if (terminated != NULL) - check_target_completion(); - continue; - } - - svc = rt->svc; - - if (svc->flags & SVC_FLAG_HAS_EXEC) { + if (terminated == NULL) + continue; + } else if (rt->svc->flags & SVC_FLAG_HAS_EXEC) { rt->pid = runsvc(rt->svc); if (rt->pid == -1) { @@ -175,13 +169,11 @@ int main(void) rt->state = STATE_RUNNING; print_status(rt); - switch (svc->type) { + switch (rt->svc->type) { case SVC_WAIT: - for (;;) { + do { terminated = wait_for_process(); - if (terminated == rt) - break; - } + } while (terminated != rt); break; case SVC_ONCE: config_singleshot_started(); -- cgit v1.2.3