X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpf.c;h=d7a5a15cff11b4cd3d2baf07297161fcc56867f3;hb=a349e06f0c4e2c853eced8a2621f52ee712b6e0c;hp=a2bd5499916d735a3ec8143e93c8d79caa3485cf;hpb=b758f3b7146f1497d93e1df64cbc0c14ae164768;p=collectd.git diff --git a/src/pf.c b/src/pf.c index a2bd5499..d7a5a15c 100644 --- a/src/pf.c +++ b/src/pf.c @@ -20,6 +20,7 @@ */ #include "collectd.h" + #include "plugin.h" #include "common.h" @@ -82,7 +83,6 @@ static int pf_read (void) struct pf_status state; int fd; int status; - int i; fd = open (pf_device, O_RDONLY); if (fd < 0) @@ -94,7 +94,6 @@ static int pf_read (void) return (-1); } - memset (&state, 0, sizeof (state)); status = ioctl (fd, DIOCGETSTATUS, &state); if (status != 0) { @@ -106,7 +105,6 @@ static int pf_read (void) } close (fd); - fd = -1; if (!state.running) { @@ -114,16 +112,16 @@ static int pf_read (void) return (-1); } - for (i = 0; i < PFRES_MAX; i++) + for (int i = 0; i < PFRES_MAX; i++) pf_submit ("pf_counters", pf_reasons[i], state.counters[i], /* is gauge = */ 0); - for (i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < LCNT_MAX; i++) pf_submit ("pf_limits", pf_lcounters[i], state.lcounters[i], /* is gauge = */ 0); - for (i = 0; i < FCNT_MAX; i++) + for (int i = 0; i < FCNT_MAX; i++) pf_submit ("pf_state", pf_fcounters[i], state.fcounters[i], /* is gauge = */ 0); - for (i = 0; i < SCNT_MAX; i++) + for (int i = 0; i < SCNT_MAX; i++) pf_submit ("pf_source", pf_scounters[i], state.scounters[i], /* is gauge = */ 0);