From: Jan Kundrát Date: Thu, 20 Feb 2014 01:13:20 +0000 (+0100) Subject: lvm: Do not segfault when there are no VGs X-Git-Tag: collectd-5.5.0~231 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d33ec28f9d965ecd598fd1229e7d2f96ef373534;p=collectd.git lvm: Do not segfault when there are no VGs --- diff --git a/src/lvm.c b/src/lvm.c index cb073321..bd227401 100644 --- a/src/lvm.c +++ b/src/lvm.c @@ -119,6 +119,11 @@ static void vg_read(vg_t vg, char const *vg_name) lvm_submit (vg_name, "free", lvm_vg_get_free_size(vg)); lvs = lvm_vg_list_lvs(vg); + if (!lvs) { + /* no VGs are defined, which is not an error per se */ + return (0); + } + dm_list_iterate_items(lvl, lvs) { name = lvm_lv_get_name(lvl->lv); attrs = get_lv_property_string(lvl->lv, "lv_attr");