Merge branch 'collectd-4.5' into collectd-4.6
[collectd.git] / src / battery.c
index 74b3344..272193e 100644 (file)
@@ -98,9 +98,8 @@ static void battery_submit (const char *plugin_instance, const char *type, doubl
 
        vl.values = values;
        vl.values_len = 1;
-       vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "battery");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "battery", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
        sstrncpy (vl.type, type, sizeof (vl.type));
 
@@ -315,7 +314,8 @@ static void get_via_generic_iokit (double *ret_charge,
 #endif /* HAVE_IOKIT_IOKITLIB_H */
 
 #if KERNEL_LINUX
-static int battery_read_acpi (const char *name)
+static int battery_read_acpi (const char __attribute__((unused)) *dir,
+               const char *name, void __attribute__((unused)) *user_data)
 {
        double  current = INVALID_VALUE;
        double  voltage = INVALID_VALUE;
@@ -506,7 +506,8 @@ static int battery_read (void)
                        battery_submit ("0", "voltage", voltage);
        }
 
-       walk_directory (battery_acpi_dir, battery_read_acpi);
+       walk_directory (battery_acpi_dir, battery_read_acpi,
+                       /* user_data = */ NULL);
 
 #endif /* KERNEL_LINUX */