projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
processes plugin: Fix error message.
[collectd.git]
/
src
/
varnish.c
diff --git
a/src/varnish.c
b/src/varnish.c
index
ebc8e7a
..
08260dc
100644
(file)
--- a/
src/varnish.c
+++ b/
src/varnish.c
@@
-152,30
+152,25
@@
static int varnish_monitor(void *priv,
conf = priv;
#if HAVE_VARNISH_V5
conf = priv;
#if HAVE_VARNISH_V5
- char namebuff[100];
- char *c;
+ char namebuff[DATA_MAX_NAME_LEN];
- c = rindex(pt->name, '.');
- strcpy(namebuff, c + 1);
+ char const *c = strrchr(pt->name, '.');
+ if (c == NULL) {
+ return EINVAL;
+ }
+ sstrncpy(namebuff, c + 1, sizeof(namebuff));
name = namebuff;
#elif HAVE_VARNISH_V4
name = namebuff;
#elif HAVE_VARNISH_V4
- const char *class;
-
- class = pt->section->fantom->type;
- name = pt->desc->name;
-
- if (strcmp(class, "MAIN") != 0)
+ if (strcmp(pt->section->fantom->type, "MAIN") != 0)
return 0;
return 0;
+ name = pt->desc->name;
#elif HAVE_VARNISH_V3
#elif HAVE_VARNISH_V3
- const char *class;
+ if (strcmp(pt->class, "") != 0)
+ return 0;
- class = pt->class;
name = pt->name;
name = pt->name;
-
- if (strcmp(class, "") != 0)
- return 0;
#endif
val = *(const volatile uint64_t *)pt->ptr;
#endif
val = *(const volatile uint64_t *)pt->ptr;