From 223535fabc55e3ef8932e9b429177dcfd2b6b62f Mon Sep 17 00:00:00 2001 From: Stefan Rinkes Date: Thu, 14 Apr 2011 21:17:45 +0200 Subject: [PATCH] pf plugin: whitespace cleanup and use sstrncpy like other plugins --- src/pf.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 + -- 2.11.0