Code

Merge remote-tracking branch 'github/pr/387'
[collectd.git] / src / xmms.c
index 238a8ee3bf5e639dc0dd0718e49683b1448716af..52beb65f8a5d21d32880f81a58be887363390873 100644 (file)
@@ -36,11 +36,11 @@ 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));
+       sstrncpy (vl.type, type, sizeof (vl.type));
 
-       plugin_dispatch_values (type, &vl);
+       plugin_dispatch_values (&vl);
 } /* void cxmms_submit */
 
 int cxmms_read (void)
@@ -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);