From: Francesco Romani Date: Mon, 12 Dec 2016 15:07:25 +0000 (+0100) Subject: virt plugin: fail init with no libvirt connection X-Git-Tag: collectd-5.8.0~267^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5903e6d5414b1a9580a63c29afff1788cec6c91e;p=collectd.git virt plugin: fail init with no libvirt connection Even though we handle disconnection and reconnection in the read() callback, we expect the libvirt connection to be available most of the time, including the init() stage. Thus, let's fail init() if the connection is not available. Signed-off-by: Francesco Romani --- diff --git a/src/virt.c b/src/virt.c index 242d0d33..93f9aee3 100644 --- a/src/virt.c +++ b/src/virt.c @@ -740,7 +740,8 @@ static int lv_init(void) { if (virInitialize() != 0) return -1; - lv_connect(); + if (lv_connect() != 0) + return -1; DEBUG(PLUGIN_NAME " plugin: starting %i instances", nr_instances);