X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fpf.c;h=449567afb77b61ee1a19ee2dbb748cf7fab61276;hp=513634c0d0f84a997f596b2423fd4e616732e961;hb=223535fabc55e3ef8932e9b429177dcfd2b6b62f;hpb=3fdb55938b0e70e042f893dadcc62cfe7a92a914 diff --git a/src/pf.c b/src/pf.c index 513634c0..449567af 100644 --- a/src/pf.c +++ b/src/pf.c @@ -28,11 +28,15 @@ #include #include #include +#include #ifndef TEST #include "collectd.h" +#include "common.h" #include "plugin.h" +#include "configfile.h" #else +#include typedef u_int64_t counter_t; #endif @@ -59,10 +63,10 @@ submit_counter(const char *type, const char *inst, counter_t val) vl.values = values; vl.values_len = 1; - strlcpy(vl.host, hostname_g, sizeof(vl.host)); - strlcpy(vl.plugin, "pf", sizeof(vl.plugin)); - strlcpy(vl.type, type, sizeof(vl.type)); - strlcpy(vl.type_instance, inst, sizeof(vl.type_instance)); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "pf", sizeof (vl.plugin)); + sstrncpy (vl.type, type, sizeof(vl.type)); + sstrncpy (vl.type_instance, inst, sizeof(vl.type_instance)); plugin_dispatch_values(&vl); #else printf("%s.%s: %lld\n", type, inst, val); @@ -76,7 +80,7 @@ pf_init(void) struct pf_status status; memset(&pd, '\0', sizeof(pd)); - + if ((pd.pd_dev = open(PF_SOCKET, O_RDWR)) == -1) { return (-1); } @@ -133,4 +137,5 @@ void module_register(void) { plugin_register_init("pf", pf_init); plugin_register_read("pf", pf_read); } -#endif \ No newline at end of file +#endif +