Merge branch 'collectd-4.4'
[collectd.git] / src / email.c
index 87daed1..9b82e10 100644 (file)
@@ -292,7 +292,7 @@ static void *collect (void *arg)
 
                        len = strlen (line);
                        if (('\n' != line[len - 1]) && ('\r' != line[len - 1])) {
-                               log_warn ("[thread #%5lu] line too long (> %i characters): "
+                               log_warn ("[thread #%5lu] line too long (> %lu characters): "
                                                "'%s' (truncated)", self, sizeof (line) - 1, line);
 
                                while (NULL != fgets (line, sizeof (line), this->socket))
@@ -394,8 +394,7 @@ static void *open_connection (void *arg)
 
        addr.sun_family = AF_UNIX;
 
-       strncpy (addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
-       addr.sun_path[UNIX_PATH_MAX - 1] = '\0';
+       sstrncpy (addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
        unlink (addr.sun_path);
 
        errno = 0;
@@ -659,9 +658,10 @@ static void email_submit (const char *type, const char *type_instance, gauge_t v
        vl.time = time (NULL);
        strcpy (vl.host, hostname_g);
        strcpy (vl.plugin, "email");
-       strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
+       sstrncpy (vl.type, type, sizeof (vl.type));
+       sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
 
-       plugin_dispatch_values (type, &vl);
+       plugin_dispatch_values (&vl);
 } /* void email_submit */
 
 /* Copy list l1 to list l2. l2 may partly exist already, but it is assumed