Code

Merge remote-tracking branch 'github/pr/387'
[collectd.git] / src / apple_sensors.c
index ee0bf8c09da13b2fb84fd487c0f9d906bccba6d5..bdba0ff85287745c960c1e5399d813aad2c116e2 100644 (file)
@@ -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
                {