X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fopenvpn.c;h=cf8c2123e9a249fb47481c88bd25d0139fdea167;hb=5a223866595c0d7eb032c3c4fc3c7cd148e59f99;hp=9ce23b4f4cb9c9e2550e86d337a866a451931404;hpb=26fbc23e518dcc74502ae3b2495112adc3840879;p=collectd.git diff --git a/src/openvpn.c b/src/openvpn.c index 9ce23b4f..cf8c2123 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -187,8 +187,6 @@ static int single_read (char *name, FILE *fh) post_compress = 0; pre_decompress = 0; post_decompress = 0; - overhead_rx = 0; - overhead_tx = 0; while (fgets (buffer, sizeof (buffer), fh) != NULL) { @@ -265,7 +263,7 @@ static int multi1_read (char *name, FILE *fh) { char buffer[1024]; char *fields[10]; - int fields_num, read = 0, found_header = 0; + int fields_num, found_header = 0; long long sum_users = 0; /* read the file until the "ROUTING TABLE" line is found (no more info after) */ @@ -312,17 +310,15 @@ static int multi1_read (char *name, FILE *fh) atoll (fields[3])); /* "Bytes Sent" */ } } - - read = 1; } + if (ferror (fh)) + return (0); + if (collect_user_count) - { numusers_submit(name, name, sum_users); - read = 1; - } - return (read); + return (1); } /* int multi1_read */ /* for reading status version 2 */