summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: df58a0a)
raw | patch | inline | side by side (parent: df58a0a)
author | Florian Forster <octo@collectd.org> | |
Mon, 1 Apr 2013 14:54:45 +0000 (16:54 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 1 Apr 2013 14:54:45 +0000 (16:54 +0200) |
Fixes Github issue #70. Thanks to Jeff for reporting this issue.
src/nfs.c | patch | blob | history |
diff --git a/src/nfs.c b/src/nfs.c
index 461e806f90ab76d0ed97747043ca1a1430a6f12c..1a4ed7487b0566378092edb3f6d8b3b84d49adab 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
/**
* collectd - src/nfs.c
* Copyright (C) 2005,2006 Jason Pepas
+ * Copyright (C) 2012,2013 Florian Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* Authors:
* Jason Pepas <cell at ices.utexas.edu>
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
* Cosmin Ioiart <cioiart at gmail.com>
**/
#if HAVE_LIBKSTAT
static int nfs_read_kstat (kstat_t *ksp, int nfs_version, char *inst,
- const char **proc_names, size_t proc_names_num)
+ char const **proc_names, size_t proc_names_num)
{
char plugin_instance[DATA_MAX_NAME_LEN];
value_t values[proc_names_num];
kstat_read(kc, ksp, NULL);
for (i = 0; i < proc_names_num; i++)
- values[i].counter = (derive_t) get_kstat_value (ksp,
- (char *)proc_names[i]);
+ {
+ /* The name passed to kstat_data_lookup() doesn't have the
+ * "const" modifier, so we need to copy the name here. */
+ char name[32];
+ sstrncpy (name, proc_names[i], sizeof (name));
+
+ values[i].counter = (derive_t) get_kstat_value (ksp, name);
+ }
nfs_procedures_submit (plugin_instance, proc_names, values,
proc_names_num);