aboutsummaryrefslogtreecommitdiff
path: root/initd
diff options
context:
space:
mode:
authorDavid Oberhollenzer <goliath@infraroot.at>2020-05-13 19:47:23 +0200
committerDavid Oberhollenzer <goliath@infraroot.at>2020-05-14 01:26:14 +0200
commit4d29cd616632034e359ca4518065aea7d3a8fa55 (patch)
tree8e8f5fbf501ed1347c7bbd10a4459439711807c1 /initd
parent22eb8fef6b6f0f836e08ab4ca92baab32e348257 (diff)
Minor cleanup
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'initd')
-rw-r--r--initd/main.c20
1 files changed, 6 insertions, 14 deletions
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();