summaryrefslogtreecommitdiff
path: root/resolv/res_send.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-10-20 07:21:57 +0000
committerJakub Jelinek <jakub@redhat.com>2008-10-20 07:21:57 +0000
commit6d8225fe1a3277273c245ceb1b35fd536300f649 (patch)
tree2c0992e862046504ff1767f29601e35981ca4d47 /resolv/res_send.c
parent315a43aa949b25896c511fa6e2efd6be57e2e01d (diff)
Updated to fedora-glibc-20081019T1815cvs/fedora-glibc-2_8_90-14
Diffstat (limited to 'resolv/res_send.c')
-rw-r--r--resolv/res_send.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 3130f64281..59cdc214e2 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -734,11 +734,11 @@ send_vc(res_state statp,
*/
int recvresp1 = 0;
int recvresp2 = buf2 == NULL;
- read_len:
- cp = ans;
uint16_t rlen16;
+ read_len:
+ cp = (u_char *)&rlen16;
len = sizeof(rlen16);
- while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, &rlen16,
+ while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, cp,
(int)len))) > 0) {
cp += n;
if ((len -= n) <= 0)
@@ -778,8 +778,16 @@ send_vc(res_state statp,
/* No buffer allocated for the first
reply. We can try to use the rest
of the user-provided buffer. */
+#ifdef _STRING_ARCH_unaligned
*anssizp2 = orig_anssizp - resplen;
*ansp2 = *ansp + resplen;
+#else
+ int aligned_resplen
+ = ((resplen + __alignof__ (HEADER) - 1)
+ & (__alignof__ (HEADER) - 1));
+ *anssizp2 = orig_anssizp - aligned_resplen;
+ *ansp2 = *ansp + aligned_resplen;
+#endif
} else {
/* The first reply did not fit into the
user-provided buffer. Maybe the second