diff --git a/src/cpufreq.c b/src/cpufreq.c
index 42248a98deebf9a8b4a5f6e5d5e7f76c72e0b2e9..1e9e857980c68c3ebcb19af9e9b8c15d3f83ddcc 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
while (1)
{
- status = snprintf (filename, sizeof (filename),
+ status = ssnprintf (filename, sizeof (filename),
"/sys/devices/system/cpu/cpu%d/cpufreq/"
"scaling_cur_freq", num_cpu);
if ((status < 1) || ((unsigned int)status >= sizeof (filename)))
vl.values = values;
vl.values_len = 1;
- vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "cpufreq");
- snprintf (vl.type_instance, sizeof (vl.type_instance),
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "cpufreq", sizeof (vl.plugin));
+ sstrncpy (vl.type, "cpufreq", sizeof (vl.type));
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%i", cpu_num);
- plugin_dispatch_values ("cpufreq", &vl);
+ plugin_dispatch_values (&vl);
}
static int cpufreq_read (void)
{
int status;
unsigned long long val;
- int i = 0;
FILE *fp;
char filename[256];
char buffer[16];
- for (i = 0; i < num_cpu; i++)
+ for (int i = 0; i < num_cpu; i++)
{
- status = snprintf (filename, sizeof (filename),
+ status = ssnprintf (filename, sizeof (filename),
"/sys/devices/system/cpu/cpu%d/cpufreq/"
"scaling_cur_freq", i);
if ((status < 1) || ((unsigned int)status >= sizeof (filename)))