[Olsr-dev] [PATCH v1 12/14] pud: fix GCC 6 warnings
Ferry Huberts
(spam-protected)
Wed Feb 24 00:46:21 CET 2016
From: Ferry Huberts <(spam-protected)>
src/netTools.c: In function ‘getIPv4Address’:
src/netTools.c:96:55: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
return &((struct sockaddr_in *)(void *) &ifr->ifr_addr)->sin_addr;
^
Signed-off-by: Ferry Huberts <(spam-protected)>
---
lib/pud/src/netTools.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/pud/src/netTools.c b/lib/pud/src/netTools.c
index f4acb7e..7627676 100644
--- a/lib/pud/src/netTools.c
+++ b/lib/pud/src/netTools.c
@@ -93,5 +93,8 @@ struct in_addr * getIPv4Address(const char * ifName, struct ifreq *ifr) {
close(fd);
- return &((struct sockaddr_in *)(void *) &ifr->ifr_addr)->sin_addr;
+ {
+ struct sockaddr* ifra = &ifr->ifr_addr;
+ return &((struct sockaddr_in *)(void *) ifra)->sin_addr;
+ }
}
--
2.5.0
More information about the Olsr-dev
mailing list