X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnfs.c;h=f5b579e1384e0d8d186c8e5c8ff3c098e48ee15d;hb=7cea19815ba24735e91dde1c08a889960b299b62;hp=461e806f90ab76d0ed97747043ca1a1430a6f12c;hpb=5fb8bff2b2d2d5c61621c6686b343d7e0eea48f0;p=collectd.git diff --git a/src/nfs.c b/src/nfs.c index 461e806f..f5b579e1 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -1,6 +1,7 @@ /** * 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 @@ -17,7 +18,7 @@ * * Authors: * Jason Pepas - * Florian octo Forster + * Florian octo Forster * Cosmin Ioiart **/ @@ -246,7 +247,7 @@ static void nfs_procedures_submit (const char *plugin_instance, vl.values = values + i; sstrncpy (vl.type_instance, type_instances[i], sizeof (vl.type_instance)); - plugin_dispatch_values_secure (&vl); + plugin_dispatch_values (&vl); } } /* void nfs_procedures_submit */ @@ -318,7 +319,7 @@ static void nfs_read_linux (FILE *fh, char *inst) #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]; @@ -332,8 +333,14 @@ static int nfs_read_kstat (kstat_t *ksp, int nfs_version, char *inst, 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);