Unified string handling.
[collectd.git] / src / dns.c
index 2cbd0c3..c315eab 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -229,13 +229,11 @@ static void *dns_child_loop (void *dummy)
        memset (&fp, 0, sizeof (fp));
        if (pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0) < 0)
        {
-               DEBUG ("pcap_compile failed");
                ERROR ("dns plugin: pcap_compile failed");
                return (NULL);
        }
        if (pcap_setfilter (pcap_obj, &fp) < 0)
        {
-               DEBUG ("pcap_setfilter failed");
                ERROR ("dns plugin: pcap_setfilter failed");
                return (NULL);
        }
@@ -303,9 +301,10 @@ static void submit_counter (const char *type, const char *type_instance,
        vl.time = time (NULL);
        strcpy (vl.host, hostname_g);
        strcpy (vl.plugin, "dns");
-       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 submit_counter */
 
 static void submit_octets (counter_t queries, counter_t responses)
@@ -321,8 +320,9 @@ static void submit_octets (counter_t queries, counter_t responses)
        vl.time = time (NULL);
        strcpy (vl.host, hostname_g);
        strcpy (vl.plugin, "dns");
+       strcpy (vl.type, "dns_octets");
 
-       plugin_dispatch_values ("dns_octets", &vl);
+       plugin_dispatch_values (&vl);
 } /* void submit_counter */
 
 static int dns_read (void)