From 1fece1f9b58eeb4c04d59908ff09ef46d81cf3fd Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 26 Sep 2012 23:10:46 +0200 Subject: [PATCH] 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 --- helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.c b/helpers.c index 784ab8b7..ea79ee71 100644 --- a/helpers.c +++ b/helpers.c @@ -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);