[collectd] [PATCH] Fixed a compile error if pcap.h is not found.

Sebastian Harl sh<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>tokkee.org
Mon Dec 4 11:04:17 CET 2006


If pcap.h is not found, the compiler complains about some "defined but not
used" warnings. As we're using -Werror this causes the build to abort.

Signed-off-by: Sebastian Harl <sh<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>tokkee.org>
---
 src/utils_dns.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/utils_dns.c b/src/utils_dns.c
index 2f6c191..2c71009 100644
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
@@ -154,15 +154,17 @@ #endif
 
 static ip_list_t *IgnoreList = NULL;
 
+#if HAVE_PCAP_H
 static void (*Callback) (const rfc1035_header_t *) = NULL;
 
 static int query_count_intvl = 0;
 static int query_count_total = 0;
-#ifdef __OpenBSD__
+# ifdef __OpenBSD__
 static struct bpf_timeval last_ts;
-#else
+# else
 static struct timeval last_ts;
-#endif
+# endif /* __OpenBSD__ */
+#endif /* HAVE_PCAP_H */
 
 static int cmp_in6_addr (const struct in6_addr *a,
 	const struct in6_addr *b)
@@ -240,6 +242,7 @@ void ignore_list_add_name (const char *n
     freeaddrinfo (ai_list);
 }
 
+#if HAVE_PCAP_H
 static void in6_addr_from_buffer (struct in6_addr *ia,
 	const void *buf, size_t buf_len,
 	int family)
@@ -256,12 +259,10 @@ static void in6_addr_from_buffer (struct
     }
 } /* void in6_addr_from_buffer */
 
-#if HAVE_PCAP_H
 void dnstop_set_pcap_obj (pcap_t *po)
 {
 	pcap_obj = po;
 }
-#endif
 
 void dnstop_set_callback (void (*cb) (const rfc1035_header_t *))
 {
@@ -594,7 +595,6 @@ handle_ether(const u_char * pkt, int len
 }
 
 /* public function */
-#if HAVE_PCAP_H
 void handle_pcap(u_char *udata, const struct pcap_pkthdr *hdr, const u_char *pkt)
 {
     int status;
@@ -642,7 +642,7 @@ #endif
     query_count_total++;
     last_ts = hdr->ts;
 }
-#endif
+#endif /* HAVE_PCAP_H */
 
 const char *qtype_str(int t)
 {
-- 
1.4.3.2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20061204/c9abfc20/attachment.pgp


More information about the collectd mailing list