diff options
Diffstat (limited to 'src/librc-depend.c')
-rw-r--r-- | src/librc-depend.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/librc-depend.c b/src/librc-depend.c index 32bbf2bd..4df64635 100644 --- a/src/librc-depend.c +++ b/src/librc-depend.c @@ -479,6 +479,7 @@ char **rc_order_services (rc_depinfo_t *deptree, const char *runlevel, char **types = NULL; char **services = NULL; bool reverse = false; + char **tmp = NULL; if (! runlevel) return (NULL); @@ -493,25 +494,33 @@ char **rc_order_services (rc_depinfo_t *deptree, const char *runlevel, strcmp (runlevel, RC_LEVEL_REBOOT) == 0) { list = rc_ls_dir (RC_SVCDIR_STARTING, RC_LS_INITD); - rc_strlist_join (&list, - rc_ls_dir (RC_SVCDIR_INACTIVE, RC_LS_INITD)); - rc_strlist_join (&list, - rc_ls_dir (RC_SVCDIR_STARTED, RC_LS_INITD)); + + tmp = rc_ls_dir (RC_SVCDIR_INACTIVE, RC_LS_INITD); + rc_strlist_join (&list, tmp); + rc_strlist_free (tmp); + + tmp = rc_ls_dir (RC_SVCDIR_INACTIVE, RC_LS_INITD); + rc_strlist_join (&list, tmp); + rc_strlist_free (tmp); reverse = true; } else { list = rc_services_in_runlevel (runlevel); /* Add coldplugged services */ - rc_strlist_join (&list, rc_ls_dir (RC_SVCDIR_COLDPLUGGED, RC_LS_INITD)); + tmp = rc_ls_dir (RC_SVCDIR_COLDPLUGGED, RC_LS_INITD); + rc_strlist_join (&list, tmp); + rc_strlist_free (tmp); /* If we're not the boot runlevel then add that too */ if (strcmp (runlevel, bootlevel) != 0) { char *path = rc_strcatpaths (RC_RUNLEVELDIR, bootlevel, (char *) NULL); - rc_strlist_join (&list, rc_ls_dir (path, RC_LS_INITD)); + tmp = rc_ls_dir (path, RC_LS_INITD); + rc_strlist_join (&list, tmp); + rc_strlist_free (tmp); free (path); } - } + } /* Now we have our lists, we need to pull in any dependencies and order them */ |