Don't assume that we have a list returned.

This commit is contained in:
Roy Marples 2008-04-10 08:49:05 +00:00
parent 0e38dcc4d2
commit 99d5046a56

View File

@ -525,7 +525,6 @@ RC_STRINGLIST *rc_deptree_order(const RC_DEPTREE *deptree,
strcmp (runlevel, RC_LEVEL_REBOOT) == 0)
{
list = rc_services_in_state(RC_SERVICE_STARTED);
list2 = rc_services_in_state(RC_SERVICE_INACTIVE);
if (list2) {
if (list) {
@ -534,7 +533,6 @@ RC_STRINGLIST *rc_deptree_order(const RC_DEPTREE *deptree,
} else
list = list2;
}
list2 = rc_services_in_state(RC_SERVICE_STARTING);
if (list2) {
if (list) {
@ -543,20 +541,28 @@ RC_STRINGLIST *rc_deptree_order(const RC_DEPTREE *deptree,
} else
list = list2;
}
TAILQ_CONCAT(list, list2, entries);
} else {
list = rc_services_in_runlevel(runlevel);
/* Add coldplugged services */
list2 = rc_services_in_state(RC_SERVICE_COLDPLUGGED);
if (list2) {
if (list) {
TAILQ_CONCAT(list, list2, entries);
free(list2);
} else
list = list2;
}
/* If we're not the boot runlevel then add that too */
if (strcmp (runlevel, bootlevel) != 0) {
list2 = rc_services_in_runlevel (bootlevel);
if (list2) {
if (list) {
TAILQ_CONCAT(list, list2, entries);
free(list2);
} else
list = list2;
}
}
}