aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2018-11-30 18:46:25 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-12-02 18:33:25 -0600
commitdb01442580847d36f232527200e50091431c32b5 (patch)
treeca64cb3e7807729d9d8f29d08e876eeb37a8d2c5 /src/rc
parentebf79db79eaa2df0ceb62b4edbef94e68a28b612 (diff)
rc-status: show failed services as failed
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-status.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index cebdc5ed..56395873 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -167,6 +167,9 @@ print_service(const char *service)
} else if (state & RC_SERVICE_SCHEDULED) {
xasprintf(&status, "scheduled");
color = ECOLOR_WARN;
+ } else if (state & RC_SERVICE_FAILED) {
+ xasprintf(&status, "failed");
+ color = ECOLOR_WARN;
} else
xasprintf(&status, " stopped ");
@@ -238,6 +241,7 @@ print_stacked_services(const char *runlevel)
int main(int argc, char **argv)
{
+ RC_SERVICE state;
RC_STRING *s, *l, *t, *level;
bool show_all = false;
char *p, *runlevel = NULL;
@@ -373,11 +377,14 @@ int main(int argc, char **argv)
free(nservices);
}
TAILQ_FOREACH_SAFE(s, services, entries, t) {
+ state = rc_service_state(s->value);
if ((rc_stringlist_find(sservices, s->value) ||
- (rc_service_state(s->value) & ( RC_SERVICE_STOPPED | RC_SERVICE_HOTPLUGGED)))) {
- TAILQ_REMOVE(services, s, entries);
- free(s->value);
- free(s);
+ (state & ( RC_SERVICE_STOPPED | RC_SERVICE_HOTPLUGGED)))) {
+ if (! (state & RC_SERVICE_FAILED)) {
+ TAILQ_REMOVE(services, s, entries);
+ free(s->value);
+ free(s);
+ }
}
}
needsme = rc_stringlist_new();