From: Pavel Rochnyack Date: Sat, 29 Oct 2016 12:25:15 +0000 (+0600) Subject: openvpn: Fixed openvpn_read() on empty configuration. X-Git-Tag: collectd-5.6.2~13^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b7e942f07f8cc3b4915aa95477aead8b5a372879;p=collectd.git openvpn: Fixed openvpn_read() on empty configuration. When plugin loaded without configuration, it starts to spam logs with message 'read-function of plugin `openvpn' failed'. Issue: #1932 --- diff --git a/src/openvpn.c b/src/openvpn.c index 00ae736a..be9a4dc8 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -525,6 +525,9 @@ static int openvpn_read (void) int read; read = 0; + + if (vpn_num == 0) + return (0); /* call the right read function for every status entry in the list */ for (int i = 0; i < vpn_num; i++) @@ -659,8 +662,8 @@ static int openvpn_config (const char *key, const char *value) if (status_version == 0) { - WARNING ("openvpn plugin: unable to detect status version, \ - discarding status file \"%s\".", value); + WARNING ("openvpn plugin: unable to detect status version, " + "discarding status file \"%s\".", value); return (1); }