From 25d7de930baa8a25b232a6276e123ca692c1e710 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Kundr=C3=A1t?= Date: Thu, 20 Feb 2014 02:13:20 +0100 Subject: [PATCH] lvm: Do not segfault when there are no VGs --- src/lvm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lvm.c b/src/lvm.c index 6ef3a7b2..12c621d0 100644 --- a/src/lvm.c +++ b/src/lvm.c @@ -53,6 +53,11 @@ static int 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) { lvm_submit(vg_name, lvm_lv_get_name(lvl->lv), lvm_lv_get_size(lvl->lv)); } -- 2.30.2