From: Stefan Rinkes Date: Thu, 14 Apr 2011 19:17:45 +0000 (+0200) Subject: pf plugin: whitespace cleanup and use sstrncpy like other plugins X-Git-Tag: collectd-5.2.0~12^2~30 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=223535fabc55e3ef8932e9b429177dcfd2b6b62f;p=collectd.git pf plugin: whitespace cleanup and use sstrncpy like other plugins --- 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 +