X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fapple_sensors.c;h=bdba0ff85287745c960c1e5399d813aad2c116e2;hb=HEAD;hp=ee0bf8c09da13b2fb84fd487c0f9d906bccba6d5;hpb=430b0b4d0275f7fea64376fc166e81fc0bcc36bf;p=collectd.git diff --git a/src/apple_sensors.c b/src/apple_sensors.c index ee0bf8c0..bdba0ff8 100644 --- a/src/apple_sensors.c +++ b/src/apple_sensors.c @@ -87,11 +87,10 @@ static void as_submit (const char *type, const char *type_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "apple_sensors"); - strcpy (vl.plugin_instance, ""); - sstrncpy (vl.type, type, sizeof (vl.type)) + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "apple_sensors", sizeof (vl.plugin)); + sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); + sstrncpy (vl.type, type, sizeof (vl.type)); sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); plugin_dispatch_values (&vl); @@ -193,17 +192,17 @@ static int as_read (void) if (strcmp (type, "temperature") == 0) { value_double = ((double) value_int) / 65536.0; - strcpy (type, "temperature"); + sstrncpy (type, "temperature", sizeof (type)); } else if (strcmp (type, "temp") == 0) { value_double = ((double) value_int) / 10.0; - strcpy (type, "temperature"); + sstrncpy (type, "temperature", sizeof (type)); } else if (strcmp (type, "fanspeed") == 0) { value_double = ((double) value_int) / 65536.0; - strcpy (type, "fanspeed"); + sstrncpy (type, "fanspeed", sizeof (type)); } else if (strcmp (type, "voltage") == 0) { @@ -213,7 +212,7 @@ static int as_read (void) else if (strcmp (type, "adc") == 0) { value_double = ((double) value_int) / 10.0; - strcpy (type, "fanspeed"); + sstrncpy (type, "fanspeed", sizeof (type)); } else {