Commit 1a3894ca authored by Mark Andrews's avatar Mark Andrews
Browse files

silence compiler warning by using offsetof to get structure elelment offsets

parent 1f695ba5
......@@ -398,7 +398,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
goto inet6_addr;
}
addrsize = sizeof(struct in_addr);
addroff = (char *)(&SIN(0)->sin_addr) - (char *)0;
addroff = offsetof(struct sockaddr_in, sin_addr);
family = AF_INET;
goto common;
#ifdef LWRES_HAVE_SIN6_SCOPE_ID
......@@ -408,7 +408,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
if (family && family != AF_INET6)
return (EAI_NONAME);
addrsize = sizeof(struct in6_addr);
addroff = (char *)(&SIN6(0)->sin6_addr) - (char *)0;
addroff = offsetof(struct sockaddr_in6, sin6_addr);
family = AF_INET6;
goto common;
#endif
......@@ -417,7 +417,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
return (EAI_NONAME);
inet6_addr:
addrsize = sizeof(struct in6_addr);
addroff = (char *)(&SIN6(0)->sin6_addr) - (char *)0;
addroff = offsetof(struct sockaddr_in6, sin6_addr);
family = AF_INET6;
common:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment