X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fhddtemp.c;h=cc67c63989d7593956f40141d848ceaa3da74c3c;hb=bc7992ed0693313a2b1fe282a5bf23f1cc9f8e42;hp=36ada53c4b2b673375e9a7982f3b62dd7dff383b;hpb=3469385f04ffcfa2f4ef06d34ed4b24acb378b34;p=collectd.git diff --git a/src/hddtemp.c b/src/hddtemp.c index 36ada53c..cc67c639 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -223,11 +223,10 @@ static int hddtemp_config (const char *key, const char *value) { int port = (int) (atof (value)); if ((port > 0) && (port <= 65535)) - snprintf (hddtemp_port, sizeof (hddtemp_port), + ssnprintf (hddtemp_port, sizeof (hddtemp_port), "%i", port); else - strncpy (hddtemp_port, value, sizeof (hddtemp_port)); - hddtemp_port[sizeof (hddtemp_port) - 1] = '\0'; + sstrncpy (hddtemp_port, value, sizeof (hddtemp_port)); } else if (strcasecmp (key, "TranslateDevicename") == 0) { @@ -430,7 +429,7 @@ static char *hddtemp_get_major_minor (char *drive) if ((ret = (char *) malloc (128 * sizeof (char))) == NULL) return (NULL); - if (snprintf (ret, 128, "%i-%i", list->major, list->minor) >= 128) + if (ssnprintf (ret, 128, "%i-%i", list->major, list->minor) >= 128) { free (ret); return (NULL); @@ -448,12 +447,12 @@ static void hddtemp_submit (char *type_instance, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "hddtemp"); - strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "hddtemp", sizeof (vl.plugin)); + sstrncpy (vl.type, "temperature", sizeof (vl.type)); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - plugin_dispatch_values ("temperature", &vl); + plugin_dispatch_values (&vl); } static int hddtemp_read (void)