diff options
Diffstat (limited to 'initd/main.c')
-rw-r--r-- | initd/main.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/initd/main.c b/initd/main.c index 6d46408..6485842 100644 --- a/initd/main.c +++ b/initd/main.c @@ -65,34 +65,22 @@ static void handle_exited(svc_run_data_t *rt) static void start_service(svc_run_data_t *rt) { - svc_run_data_t *terminated; + if (rt->svc->flags & SVC_FLAG_HAS_EXEC) { + rt->pid = runsvc(rt->svc); + if (rt->pid == -1) { + rt->state = STATE_FAILED; + } else { + rt->state = STATE_RUNNING; - if (!(rt->svc->flags & SVC_FLAG_HAS_EXEC)) { + if (rt->svc->type == SVC_WAIT) + config_set_waiting(rt); + } + } else { rt->status = EXIT_SUCCESS; rt->state = STATE_COMPLETED; - print_status(rt); - return; } - rt->pid = runsvc(rt->svc); - if (rt->pid == -1) { - rt->state = STATE_FAILED; - print_status(rt); - return; - } - - rt->state = STATE_RUNNING; print_status(rt); - - switch (rt->svc->type) { - case SVC_WAIT: - do { - terminated = wait_for_process(); - if (terminated != NULL) - handle_exited(terminated); - } while (terminated != rt); - break; - } } static void handle_signal(int signo) |