1 From 46e716ee8d4208924d10f57f9ed97c99674a6ef4 Mon Sep 17 00:00:00 2001
2 From: Michael Tremer <michael.tremer@ipfire.org>
3 Date: Wed, 17 Sep 2014 11:31:13 +0200
4 Subject: [PATCH 20/22] openvpn: Make read functions robust like in
5 8516f9abb625fa7b9321e62307305aa6499be4e8
8 src/openvpn.c | 21 ++++++---------------
9 1 file changed, 6 insertions(+), 15 deletions(-)
11 diff --git a/src/openvpn.c b/src/openvpn.c
12 index 6a0ffbd..f686721 100644
15 @@ -332,7 +332,7 @@ static int multi2_read (char *name, FILE *fh)
18 const int max_fields = STATIC_ARRAY_SIZE (fields);
19 - int fields_num, read = 0;
21 long long sum_users = 0;
23 while (fgets (buffer, sizeof (buffer), fh) != NULL)
24 @@ -379,17 +379,14 @@ static int multi2_read (char *name, FILE *fh)
25 atoll (fields[5])); /* "Bytes Sent" */
32 if (collect_user_count)
34 numusers_submit(name, name, sum_users);
40 } /* int multi2_read */
42 /* for reading status version 3 */
43 @@ -398,7 +395,7 @@ static int multi3_read (char *name, FILE *fh)
46 const int max_fields = STATIC_ARRAY_SIZE (fields);
47 - int fields_num, read = 0;
49 long long sum_users = 0;
51 while (fgets (buffer, sizeof (buffer), fh) != NULL)
52 @@ -447,18 +444,15 @@ static int multi3_read (char *name, FILE *fh)
53 atoll (fields[5])); /* "Bytes Sent" */
61 if (collect_user_count)
63 numusers_submit(name, name, sum_users);
69 } /* int multi3_read */
71 /* for reading status version 4 */
72 @@ -467,7 +461,7 @@ static int multi4_read (char *name, FILE *fh)
75 const int max_fields = STATIC_ARRAY_SIZE (fields);
76 - int fields_num, read = 0;
78 long long sum_users = 0;
80 while (fgets (buffer, sizeof (buffer), fh) != NULL)
81 @@ -515,17 +509,14 @@ static int multi4_read (char *name, FILE *fh)
82 atoll (fields[5])); /* "Bytes Sent" */
89 if (collect_user_count)
91 numusers_submit(name, name, sum_users);
97 } /* int multi4_read */