bec77d
commit d62f79d7905149719715f74c188b47d7911c928c
bec77d
Author: Steve Dickson <steved@redhat.com>
bec77d
Date:   Mon Aug 18 11:44:19 2014 -0400
bec77d
bec77d
    rpcbind: Remove a strict-aliasing warning
bec77d
    
bec77d
    src/util.c: In function ?in6_fillscopeid?:
bec77d
    src/util.c:106:3: warning: dereferencing type-punned pointer will break
bec77d
    strict-aliasing rules [-Wstrict-aliasing]
bec77d
       ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]);
bec77d
       ^
bec77d
    
bec77d
    src/util.c:109:4: warning: dereferencing type-punned pointer will break
bec77d
    strict-aliasing rules [-Wstrict-aliasing]
bec77d
        *(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0;
bec77d
    
bec77d
    Signed-off-by: Steve Dickson <steved@redhat.com>
bec77d
bec77d
diff --git a/src/util.c b/src/util.c
bec77d
index 9a5fb69..7d56479 100644
bec77d
--- a/src/util.c
bec77d
+++ b/src/util.c
bec77d
@@ -101,12 +101,14 @@ static void
bec77d
 in6_fillscopeid(struct sockaddr_in6 *sin6)
bec77d
 {
bec77d
 	u_int16_t ifindex;
bec77d
+	u_int16_t *addr;
bec77d
 
bec77d
         if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
bec77d
-		ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]);
bec77d
+		addr = (u_int16_t *)&sin6->sin6_addr.s6_addr[2];
bec77d
+		ifindex = ntohs(*addr);
bec77d
 		if (sin6->sin6_scope_id == 0 && ifindex != 0) {
bec77d
 			sin6->sin6_scope_id = ifindex;
bec77d
-			*(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0;
bec77d
+			*addr = 0;
bec77d
 		}
bec77d
 	}
bec77d
 }