Cleaner output if sections are empty
Even with a completely empty config we still get the following output:
root
sysinfo
load: 0.87/0.92/0.98
ram: 243/168/0
uptime: 1d 22:18:19
netdev
ping
file
shellcmd
With this patch the sections are skipped if there are no entries and the
command no sysinfo can be used to skip displaying the system
information.
Change-Id: I429fe7626b43aef74ff7458f5c2864888fa9a562
diff --git a/src/osysmon_file.c b/src/osysmon_file.c
index 1dec3db..8e52497 100644
--- a/src/osysmon_file.c
+++ b/src/osysmon_file.c
@@ -153,6 +153,9 @@
struct value_node *vn_file;
struct osysmon_file *of;
+ if (llist_empty(&g_oss->files))
+ return 0;
+
vn_file = value_node_add(parent, "file", NULL);
llist_for_each_entry(of, &g_oss->files, list)