diff options
author | Roy Marples <roy@marples.name> | 2009-04-28 08:29:02 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2009-04-28 08:29:02 +0000 |
commit | e0f0fc8046bed6d21a92d0ef6f708d3ce5ef5c1c (patch) | |
tree | caaa973110e22d91e794f99365d9c5cf09fdc43a /src | |
parent | 48f477f851d6ac0a1867ff6b405bbdfae401b0d2 (diff) |
Don't start services when their need dependency is broken
Diffstat (limited to 'src')
-rw-r--r-- | src/librc/librc-depend.c | 11 | ||||
-rw-r--r-- | src/rc/runscript.c | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index 45c3dd02..bd67ed93 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -899,11 +899,20 @@ rc_deptree_update(void) TAILQ_FOREACH(s, deptype->services, entries) { di = get_depinfo(deptree, s->value); if (!di) { - if (strcmp(deptype->type, "ineed") == 0) + if (strcmp(deptype->type, "ineed") == 0) { fprintf (stderr, "Service `%s' needs non" " existant service `%s'\n", depinfo->service, s->value); + dt = get_deptype(depinfo, "broken"); + if (!dt) { + dt = xmalloc(sizeof(*dt)); + dt->type = xstrdup("broken"); + dt->services = rc_stringlist_new(); + TAILQ_INSERT_TAIL(&depinfo->depends, dt, entries); + } + rc_stringlist_addu(dt->services, s->value); + } continue; } diff --git a/src/rc/runscript.c b/src/rc/runscript.c index b4ce0f88..c2688ee0 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -633,7 +633,7 @@ svc_start(bool deps) services = rc_deptree_depends(deptree, types_b, applet_list, runlevel, 0); if (TAILQ_FIRST(services)) { - eerrorn("ERROR: `%s' needs ", applet); + eerrorn("ERROR: %s needs service(s) ", applet); first = true; TAILQ_FOREACH(svc, services, entries) { if (first) @@ -642,6 +642,7 @@ svc_start(bool deps) fprintf(stderr, ", "); fprintf(stderr, "%s", svc->value); } + fprintf(stderr, "\n"); exit(EXIT_FAILURE); } rc_stringlist_free(services); |