summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-01-29 18:33:50 +0100
committerJohn Crispin <blogic@openwrt.org>2014-01-29 18:33:50 +0100
commit8a9ffa6ec88d2b199d9262666dadcd962da82fb5 (patch)
tree53db0352a96e93896769372b37cf71579aa580e4 /service
parente0921ed71bab0ad7d2344774a33c22809eb10190 (diff)
downloadunitd-8a9ffa6ec88d2b199d9262666dadcd962da82fb5.tar
unitd-8a9ffa6ec88d2b199d9262666dadcd962da82fb5.zip
fix the dump logic to show validators and triggers even if no instances exist
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'service')
-rw-r--r--service/service.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/service/service.c b/service/service.c
index 3ec24c3..3fc8424 100644
--- a/service/service.c
+++ b/service/service.c
@@ -259,15 +259,12 @@ service_dump(struct service *s, int verbose)
c = blobmsg_open_table(&b, s->name);
- if (avl_is_empty(&s->instances.avl)) {
- blobmsg_close_table(&b, c);
- return;
+ if (!avl_is_empty(&s->instances.avl)) {
+ i = blobmsg_open_table(&b, "instances");
+ vlist_for_each_element(&s->instances, in, node)
+ instance_dump(&b, in, verbose);
+ blobmsg_close_table(&b, i);
}
-
- i = blobmsg_open_table(&b, "instances");
- vlist_for_each_element(&s->instances, in, node)
- instance_dump(&b, in, verbose);
- blobmsg_close_table(&b, i);
if (verbose && s->trigger)
blobmsg_add_blob(&b, s->trigger);
if (verbose && !list_empty(&s->validators))