Code

collectd.conf(5): Documented the option of the rrdtool-plugin.
[collectd.git] / src / ntpd.c
index d65d1ed9e60c2e42c46bc6b404fe58559b162afa..e37b3a1cefad037e286dd4bde0cd640940740898 100644 (file)
@@ -51,8 +51,8 @@
 #if HAVE_NETINET_TCP_H
 # include <netinet/tcp.h>
 #endif
-#if HAVE_SYS_POLL_H
-# include <sys/poll.h>
+#if HAVE_POLL_H
+# include <poll.h>
 #endif
 
 static char *config_keys[] =
@@ -694,6 +694,7 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
                                (items_num + pkt_item_num) * res_item_size);
                items = realloc ((void *) *res_data,
                                (items_num + pkt_item_num) * res_item_size);
+               items_num += pkt_item_num;
                if (items == NULL)
                {
                        items = *res_data;
@@ -881,7 +882,7 @@ static void ntpd_read (void)
                struct info_peer_summary *ptr;
                double offset;
 
-               char peername[512];
+               char peername[NI_MAXHOST];
                int refclock_id;
                
                ptr = ps + i;