Merge branch 'collectd-4.5' into collectd-4.6
[collectd.git] / src / powerdns.c
index 9d93f93..164137b 100644 (file)
 #endif
 #define FUNC_ERROR(func) do { char errbuf[1024]; ERROR ("powerdns plugin: %s failed: %s", func, sstrerror (errno, errbuf, sizeof (errbuf))); } while (0)
 
-#define SERVER_SOCKET  "/var/run/pdns.controlsocket"
+#define SERVER_SOCKET  LOCALSTATEDIR"/run/pdns.controlsocket"
 #define SERVER_COMMAND "SHOW *"
 
-#define RECURSOR_SOCKET  "/var/run/pdns_recursor.controlsocket"
+#define RECURSOR_SOCKET  LOCALSTATEDIR"/run/pdns_recursor.controlsocket"
 #define RECURSOR_COMMAND "get noerror-answers nxdomain-answers " \
   "servfail-answers sys-msec user-msec qa-latency cache-entries cache-hits " \
   "cache-misses questions"
@@ -317,7 +317,6 @@ static void submit (const char *plugin_instance, /* {{{ */
 
   vl.values = values;
   vl.values_len = 1;
-  vl.time = time (NULL);
   sstrncpy (vl.host, hostname_g, sizeof (vl.host));
   sstrncpy (vl.plugin, "powerdns", sizeof (vl.plugin));
   sstrncpy (vl.type, type, sizeof (vl.type));
@@ -619,7 +618,7 @@ static int powerdns_update_recursor_command (list_item_t *li) /* {{{ */
   }
   else
   {
-    strcpy (buffer, "get ");
+    sstrncpy (buffer, "get ", sizeof (buffer));
     status = strjoin (&buffer[4], sizeof (buffer) - strlen ("get "),
        li->fields, li->fields_num,
        /* seperator = */ " ");