Only report unassigned services when there are any, Gentoo #218005.

This commit is contained in:
Roy Marples 2008-04-16 19:47:19 +00:00
parent 725b9dc89c
commit 425abe40c5

View File

@ -185,7 +185,7 @@ static const char * const longopts_help[] = {
int rc_status(int argc, char **argv) int rc_status(int argc, char **argv)
{ {
RC_STRINGLIST *levels = NULL; RC_STRINGLIST *levels = NULL;
RC_STRINGLIST *services; RC_STRINGLIST *services = NULL;
RC_STRING *s, *l, *t; RC_STRING *s, *l, *t;
char *p; char *p;
int opt; int opt;
@ -256,9 +256,10 @@ int rc_status(int argc, char **argv)
} }
/* Show unassigned running too */ /* Show unassigned running too */
if (argc < 2) { if (argc < 2 &&
(services = rc_services_in_runlevel(NULL)))
{
print_level("UNASSIGNED"); print_level("UNASSIGNED");
services = rc_services_in_runlevel(NULL);
rc_stringlist_free(levels); rc_stringlist_free(levels);
levels = rc_runlevel_list(); levels = rc_runlevel_list();
TAILQ_FOREACH_SAFE(s, services, entries, t) { TAILQ_FOREACH_SAFE(s, services, entries, t) {