diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2015-03-14 16:29:36 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-03-27 16:30:47 +0100 |
commit | 2b84054e2f9fa7301af4dbef4dcbf1cba066ecb3 (patch) | |
tree | dc3bea9e5f3ea23c0777eace492b396f0482b25d /src | |
parent | 1426ee8756a1df4ec0651417dce92e1dcc8a246d (diff) | |
download | sssd-2b84054e2f9fa7301af4dbef4dcbf1cba066ecb3.tar.gz sssd-2b84054e2f9fa7301af4dbef4dcbf1cba066ecb3.tar.xz sssd-2b84054e2f9fa7301af4dbef4dcbf1cba066ecb3.zip |
test_resolv_fake: Fix alignment warning
src/tests/cmocka/test_resolv_fake.c:60:9:
error: cast from 'uint8_t *' (aka 'unsigned char *') to 'HEADER *'
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
h = (HEADER *) hb;
^~~~~~~~~~~~~
1 error generated.
Reviewed-by: Michal Židek <mzidek@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/cmocka/test_resolv_fake.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/tests/cmocka/test_resolv_fake.c b/src/tests/cmocka/test_resolv_fake.c index eac5697e4..2c846ce4c 100644 --- a/src/tests/cmocka/test_resolv_fake.c +++ b/src/tests/cmocka/test_resolv_fake.c @@ -52,20 +52,21 @@ struct srv_rrdata { static ssize_t dns_header(unsigned char **buf, size_t ancount) { uint8_t *hb; - HEADER *h; + HEADER h; hb = *buf; memset(hb, 0, NS_HFIXEDSZ); + memset(&h, 0, sizeof(h)); - h = (HEADER *) hb; - h->id = res_randomid(); /* random query ID */ - h->qr = 1; /* response flag */ - h->rd = 1; /* recursion desired */ - h->ra = 1; /* resursion available */ + h.id = res_randomid(); /* random query ID */ + h.qr = 1; /* response flag */ + h.rd = 1; /* recursion desired */ + h.ra = 1; /* resursion available */ - h->qdcount = htons(1); /* no. of questions */ - h->ancount = htons(ancount); /* no. of answers */ - h->arcount = htons(0); /* no. of add'tl records */ + h.qdcount = htons(1); /* no. of questions */ + h.ancount = htons(ancount); /* no. of answers */ + h.arcount = htons(0); /* no. of add'tl records */ + memcpy(hb, &h, sizeof(h)); hb += NS_HFIXEDSZ; /* move past the header */ *buf = hb; |