Work around compiler error for breaking strict-aliasing rules

This commit fixes the following warning on an ARM eabi/uClibc system.
helpers.c:86: error: dereferencing pointer 'a' does break strict-aliasing rules

The fix is trivial. Simply set IPv4 addressing scheme in the
struct ifreq instead of the struct sockaddr_in, whic is just
a pointer into the same ifreq anyway.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2012-09-26 23:10:53 +02:00
parent 814ff1f77e
commit 1fece1f9b5
+1 -1
View File
@@ -83,7 +83,7 @@ void ifconfig(char *name, char *inet, char *mask, int up)
memset(&ifr, 0, sizeof (ifr));
strlcpy(ifr.ifr_name, name, IFNAMSIZ);
a->sin_family = AF_INET;
ifr.ifr_addr.sa_family = AF_INET;
if (up) {
inet_aton(inet, &a->sin_addr);