rwrap: Don't use htons for bitfields.
authorJakub Hrozek <jakub.hrozek@gmail.com>
Tue, 21 Oct 2014 15:23:30 +0000 (17:23 +0200)
committerAndreas Schneider <asn@samba.org>
Thu, 23 Oct 2014 12:13:33 +0000 (14:13 +0200)
On FreeBSD, using htons to set the bitfield led to warnings such as:
resolv_wrapper.c:162:8: warning: implicit truncation from '__uint16_t'
(aka 'unsigned short') to bitfield changes value from 256 to 0
[-Wbitfield-constant-conversion]
        h->qr = htons(1);               /* response flag */
              ^ ~~~~~~~~

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
src/resolv_wrapper.c

index d4b16fa..dffba57 100644 (file)
@@ -163,9 +163,9 @@ static ssize_t rwrap_fake_header(uint8_t **header_blob, size_t remaining,
 
        h = (HEADER *) hb;
        h->id = res_randomid();         /* random query ID */
-       h->qr = htons(1);               /* response flag */
-       h->rd = htons(1);               /* recursion desired */
-       h->ra = htons(1);               /* resursion available */
+       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(answers);    /* no. of answers */