X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fhddtemp.c;h=a9c094186516b699c7771249c29a026bbf2d2891;hb=5f9ec13b946733ff4e1edf2d8e3b7a22311dd894;hp=b4a50ac77f9ac7790db010dddae2c341ab8fb765;hpb=2354eda94fa44c8bcb8e39b24b117e7937110224;p=collectd.git diff --git a/src/hddtemp.c b/src/hddtemp.c index b4a50ac7..a9c09418 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); @@ -452,7 +451,7 @@ static void hddtemp_submit (char *type_instance, double value) strcpy (vl.host, hostname_g); strcpy (vl.plugin, "hddtemp"); strcpy (vl.type, "temperature"); - strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); plugin_dispatch_values (&vl); }