configure.in: Check for `mysql_get_server_version' in libmyql.
[collectd.git] / src / multimeter.c
index e09d9f9..9c9c2c1 100644 (file)
@@ -86,7 +86,12 @@ static int multimeter_read_value(double *value)
                        struct timeval timeout;
                        struct timeval time_now;
 
-                       write(fd, "D", 1);
+                       status = swrite (fd, "D", 1);
+                       if (status < 0)
+                       {
+                               ERROR ("multimeter plugin: swrite failed.");
+                               return (-1);
+                       }
 
                        FD_ZERO(&rfds);
                        FD_SET(fd, &rfds);
@@ -216,9 +221,9 @@ static void multimeter_submit (double value)
        vl.values = values;
        vl.values_len = 1;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "multimeter");
-       strcpy (vl.type, "multimeter");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "multimeter", sizeof (vl.plugin));
+       sstrncpy (vl.type, "multimeter", sizeof (vl.type));
 
        plugin_dispatch_values (&vl);
 }