Don't start services when their need dependency is broken
This commit is contained in:
parent
48f477f851
commit
e0f0fc8046
@ -899,11 +899,20 @@ rc_deptree_update(void)
|
|||||||
TAILQ_FOREACH(s, deptype->services, entries) {
|
TAILQ_FOREACH(s, deptype->services, entries) {
|
||||||
di = get_depinfo(deptree, s->value);
|
di = get_depinfo(deptree, s->value);
|
||||||
if (!di) {
|
if (!di) {
|
||||||
if (strcmp(deptype->type, "ineed") == 0)
|
if (strcmp(deptype->type, "ineed") == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Service `%s' needs non"
|
"Service `%s' needs non"
|
||||||
" existant service `%s'\n",
|
" existant service `%s'\n",
|
||||||
depinfo->service, s->value);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ svc_start(bool deps)
|
|||||||
services = rc_deptree_depends(deptree, types_b, applet_list,
|
services = rc_deptree_depends(deptree, types_b, applet_list,
|
||||||
runlevel, 0);
|
runlevel, 0);
|
||||||
if (TAILQ_FIRST(services)) {
|
if (TAILQ_FIRST(services)) {
|
||||||
eerrorn("ERROR: `%s' needs ", applet);
|
eerrorn("ERROR: %s needs service(s) ", applet);
|
||||||
first = true;
|
first = true;
|
||||||
TAILQ_FOREACH(svc, services, entries) {
|
TAILQ_FOREACH(svc, services, entries) {
|
||||||
if (first)
|
if (first)
|
||||||
@ -642,6 +642,7 @@ svc_start(bool deps)
|
|||||||
fprintf(stderr, ", ");
|
fprintf(stderr, ", ");
|
||||||
fprintf(stderr, "%s", svc->value);
|
fprintf(stderr, "%s", svc->value);
|
||||||
}
|
}
|
||||||
|
fprintf(stderr, "\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
rc_stringlist_free(services);
|
rc_stringlist_free(services);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user