Merge branch 'collectd-4.4' into collectd-4.5
[collectd.git] / src / ipvs.c
index 2de28dd..85e65d2 100644 (file)
@@ -191,7 +191,7 @@ static int get_pi (struct ip_vs_service_entry *se, char *pi, size_t size)
 
        /* inet_ntoa() returns a pointer to a statically allocated buffer
         * I hope non-glibc systems behave the same */
-       len = snprintf (pi, size, "%s_%s%u", inet_ntoa (addr),
+       len = ssnprintf (pi, size, "%s_%s%u", inet_ntoa (addr),
                        (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP",
                        ntohs (se->port));
 
@@ -215,7 +215,7 @@ static int get_ti (struct ip_vs_dest_entry *de, char *ti, size_t size)
 
        /* inet_ntoa() returns a pointer to a statically allocated buffer
         * I hope non-glibc systems behave the same */
-       len = snprintf (ti, size, "%s_%u", inet_ntoa (addr),
+       len = ssnprintf (ti, size, "%s_%u", inet_ntoa (addr),
                        ntohs (de->port));
 
        if ((0 > len) || (size <= len)) {
@@ -241,9 +241,11 @@ static void cipvs_submit_connections (char *pi, char *ti, counter_t value)
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance));
-       sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", sizeof (vl.type_instance));
+       sstrncpy (vl.type, "connections", sizeof (vl.type));
+       sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total",
+               sizeof (vl.type_instance));
 
-       plugin_dispatch_values ("connections", &vl);
+       plugin_dispatch_values (&vl);
        return;
 } /* cipvs_submit_connections */
 
@@ -265,9 +267,11 @@ static void cipvs_submit_if (char *pi, char *t, char *ti,
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance));
-       sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", sizeof (vl.type_instance));
+       sstrncpy (vl.type, t, sizeof (vl.type));
+       sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total",
+               sizeof (vl.type_instance));
 
-       plugin_dispatch_values (t, &vl);
+       plugin_dispatch_values (&vl);
        return;
 } /* cipvs_submit_if */