projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3fdb559
)
pf plugin: whitespace cleanup and use sstrncpy like other plugins
author
Stefan Rinkes
<stefan.rinkes@gmail.com>
Thu, 14 Apr 2011 19:17:45 +0000
(21:17 +0200)
committer
Stefan Rinkes
<stefan.rinkes@gmail.com>
Thu, 14 Apr 2011 19:17:45 +0000
(21:17 +0200)
src/pf.c
patch
|
blob
|
history
diff --git
a/src/pf.c
b/src/pf.c
index
513634c
..
449567a
100644
(file)
--- a/
src/pf.c
+++ b/
src/pf.c
@@
-28,11
+28,15
@@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <unistd.h>
#ifndef TEST
#include "collectd.h"
#ifndef TEST
#include "collectd.h"
+#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "configfile.h"
#else
#else
+#include <err.h>
typedef u_int64_t counter_t;
#endif
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;
vl.values = values;
vl.values_len = 1;
- s
trlcpy(vl.host, hostname_g, sizeof
(vl.host));
- s
trlcpy(vl.plugin, "pf", sizeof
(vl.plugin));
- s
trlcpy
(vl.type, type, sizeof(vl.type));
- s
trlcpy
(vl.type_instance, inst, sizeof(vl.type_instance));
+ s
strncpy (vl.host, hostname_g, sizeof
(vl.host));
+ s
strncpy (vl.plugin, "pf", sizeof
(vl.plugin));
+ s
strncpy
(vl.type, type, sizeof(vl.type));
+ s
strncpy
(vl.type_instance, inst, sizeof(vl.type_instance));
plugin_dispatch_values(&vl);
#else
printf("%s.%s: %lld\n", type, inst, val);
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));
struct pf_status status;
memset(&pd, '\0', sizeof(pd));
-
+
if ((pd.pd_dev = open(PF_SOCKET, O_RDWR)) == -1) {
return (-1);
}
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);
}
plugin_register_init("pf", pf_init);
plugin_register_read("pf", pf_read);
}
-#endif
\ No newline at end of file
+#endif
+