X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fopenvpn.c;h=2c93a00977a7fdbe72162187381391d2fc02b831;hb=aee87d9c1665ca8823c7489bfc9900ff12e0e177;hp=9ce23b4f4cb9c9e2550e86d337a866a451931404;hpb=d6021a800b12c89b5a78877af2c5b9abc1a8e609;p=collectd.git diff --git a/src/openvpn.c b/src/openvpn.c index 9ce23b4f..2c93a009 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -265,7 +265,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 +312,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 */