Fix type instance sanitization in bind plugin
[collectd.git] / src / zfs_arc.c
index 43e5b03..79a234f 100644 (file)
 /*
  * Global variables
  */
-static kstat_t *ksp;
+
 extern kstat_ctl_t *kc;
 
-static void za_submit (const char* type, const char* type_instance, value_t values[], int values_len)
+static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len)
 {
        value_list_t vl = VALUE_LIST_INIT;
 
@@ -39,7 +39,7 @@ static void za_submit (const char* type, const char* type_instance, value_t valu
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "zfs_arc", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
-       sstrncpy (vl.type_instance, type_instance, sizeof (vl.type));
+       sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
 
        plugin_dispatch_values (&vl);
 }
@@ -94,6 +94,7 @@ static int za_read (void)
        counter_t demand_data_hits, demand_metadata_hits, prefetch_data_hits, prefetch_metadata_hits;
        counter_t demand_data_misses, demand_metadata_misses, prefetch_data_misses, prefetch_metadata_misses;
        counter_t l2_read_bytes, l2_write_bytes;
+       kstat_t  *ksp   = NULL;
 
        get_kstat (&ksp, "zfs", 0, "arcstats");
        if (ksp == NULL)
@@ -145,8 +146,6 @@ static int za_read (void)
 
 static int za_init (void) /* {{{ */
 {
-       ksp = NULL;
-
        /* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */
        if (kc == NULL)
        {