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