Code

patches: Added bts747093_lvm_segfault.
authorSebastian Harl <sh@tokkee.org>
Sun, 23 Nov 2014 12:27:06 +0000 (13:27 +0100)
committerSebastian Harl <sh@tokkee.org>
Sun, 23 Nov 2014 12:28:37 +0000 (13:28 +0100)
Upstream fix for a segfault in the LVM plugin. Thanks to Bernd Zeimetz and
Marc Fournier for reporting this.

Closes: #747093
debian/changelog
debian/patches/00list
debian/patches/bts747093_lvm_segfault.dpatch [new file with mode: 0755]

index eb58e134609896533ee169ee7c59639720fa0487..f192cfe5a715cef72646d67fe9c4b651530b15b0 100644 (file)
@@ -4,6 +4,9 @@ collectd (5.4.1-6) UNRELEASED; urgency=medium
     - Added bts770681_riemann_ack: upstream fix for the write_riemann plugin
       to avoid locking up a remote Riemann instance; thanks to Marc Fournier
       for reporting this (Closes: #770681).
+    - Added bts747093_lvm_segfault: upstream fix for a segfault in the LVM
+      plugin; thanks to Bernd Zeimetz and Marc Fournier for reporting this
+      (Closes: #747093).
 
  -- Sebastian Harl <tokkee@debian.org>  Sun, 23 Nov 2014 13:04:03 +0100
 
index 78e7f2d8c17edd217bec1c52fe8fc4dce9721031..f1f07e7581417a36c9e878480dd7dea7f76333fe 100644 (file)
@@ -5,3 +5,4 @@ myplugin_includes.dpatch
 myplugin_api.dpatch
 bts559801_plugin_find_fix.dpatch
 bts770681_riemann_ack.dpatch
+bts747093_lvm_segfault.dpatch
diff --git a/debian/patches/bts747093_lvm_segfault.dpatch b/debian/patches/bts747093_lvm_segfault.dpatch
new file mode 100755 (executable)
index 0000000..d9b9650
--- /dev/null
@@ -0,0 +1,26 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+##
+## DP: bts747093_lvm_segfault.dpatch by Jan Kundrát <jan.kundrat@cesnet.cz>
+## DP:
+## DP: lvm: Fix segfault when there are no logical volumes.
+## DP:
+## DP: Upstream bug report:
+## DP: https://github.com/collectd/collectd/pull/425
+
+@DPATCH@
+
+diff a/src/lvm.c b/src/lvm.c
+--- 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));
+     }