Replace all occurrences of `strcpy' with `sstrncpy'.
[collectd.git] / src / xmms.c
index 238a8ee..7f3edf0 100644 (file)
@@ -37,8 +37,8 @@ static void cxmms_submit (const char *type, gauge_t value)
        vl.values = values;
        vl.values_len = 1;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "xmms");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "xmms", sizeof (vl.plugin));
 
        plugin_dispatch_values (type, &vl);
 } /* void cxmms_submit */
@@ -55,7 +55,7 @@ int cxmms_read (void)
   xmms_remote_get_info (xmms_session, &rate, &freq, &nch);
 
   if ((freq == 0) || (nch == 0))
-    return (0);
+    return (-1);
 
   cxmms_submit ("bitrate", rate);
   cxmms_submit ("frequency", freq);