summaryrefslogtreecommitdiff
path: root/lib/libc/net
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-29 21:08:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-29 21:08:55 +0000
commit768549f5ba3aa3ed5c39395de67a160720ec9d19 (patch)
treeb9c90a448e20c821bfb2fb7aba66880256dbb9bd /lib/libc/net
parent3f7b7124077939e380e6d74611447a34605eee10 (diff)
use a union to align the dns answer buffer until gcc4 is fixed
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/res_query.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libc/net/res_query.c b/lib/libc/net/res_query.c
index c8a45a5df5b..1485abb2d7d 100644
--- a/lib/libc/net/res_query.c
+++ b/lib/libc/net/res_query.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_query.c,v 1.25 2007/05/16 04:14:23 ray Exp $ */
+/* $OpenBSD: res_query.c,v 1.26 2010/06/29 21:08:54 deraadt Exp $ */
/*
* ++Copyright++ 1988, 1993
@@ -96,7 +96,10 @@ res_query(const char *name,
int anslen) /* size of answer buffer */
{
struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
- u_char buf[MAXPACKET];
+ union {
+ HEADER hdr;
+ u_char buf[MAXPACKET];
+ } buf;
HEADER *hp = (HEADER *) answer;
int n;
@@ -112,10 +115,10 @@ res_query(const char *name,
#endif
n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL,
- buf, sizeof(buf));
+ buf.buf, sizeof(buf.buf));
if (n > 0 && ((_resp->options & RES_USE_EDNS0) ||
(_resp->options & RES_USE_DNSSEC))) {
- n = res_opt(n, buf, sizeof(buf), anslen);
+ n = res_opt(n, buf.buf, sizeof(buf.buf), anslen);
}
if (n <= 0) {
@@ -126,7 +129,7 @@ res_query(const char *name,
h_errno = NO_RECOVERY;
return (n);
}
- n = res_send(buf, n, answer, anslen);
+ n = res_send(buf.buf, n, answer, anslen);
if (n < 0) {
#ifdef DEBUG
if (_resp->options & RES_DEBUG)