Check list existance before iterating, Gentoo #216091.

This commit is contained in:
Roy Marples 2008-04-04 16:31:56 +00:00
parent 5ebe7f1349
commit c18c4fc4cc

View File

@ -648,6 +648,19 @@ static void setup_types(void)
rc_stringlist_add(types_mua, "beforeme");
}
static bool in_list(RC_STRINGLIST *list, char *string)
{
RC_STRING *s;
if (! list)
return false;
TAILQ_FOREACH(s, list, entries)
if (strcmp(s->value, string) == 0)
return true;
return false;
}
static void svc_start(bool deps)
{
bool started;
@ -747,24 +760,19 @@ static void svc_start(bool deps)
/* Don't wait for services which went inactive but are now in
* starting state which we are after */
if (svcs & RC_SERVICE_STARTING &&
svcs & RC_SERVICE_WASINACTIVE) {
TAILQ_FOREACH(svc2, use_services, entries) {
if (strcmp (svc->value, svc2->value) == 0)
break;
}
if (! svc2)
svcs & RC_SERVICE_WASINACTIVE)
{
if (!in_list(need_services, svc->value) &&
!in_list(use_services, svc->value))
continue;
}
if (! svc_wait(svc->value))
eerror ("%s: timed out waiting for %s",
applet, svc->value);
if (! need_services)
continue;
if ((svcs = rc_service_state(svc->value)) & RC_SERVICE_STARTED)
continue;
TAILQ_FOREACH(svc2, need_services, entries) {
if (strcmp (svc->value, svc2->value) == 0) {
if (in_list(need_services, svc->value)) {
if (svcs & RC_SERVICE_INACTIVE ||
svcs & RC_SERVICE_WASINACTIVE)
{
@ -777,7 +785,6 @@ static void svc_start(bool deps)
applet, svc->value);
}
}
}
if (tmplist && TAILQ_FIRST(tmplist)) {
/* Set the state now, then unlink our exclusive so that