This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 05/19/2015 03:53 PM, Steve Ellcey wrote:
+ union + { + struct sockaddr *sa; + struct sockaddr_in *sin; + } ss; int sd, num, i; /* Save errno. */ int save = errno; @@ -443,14 +448,14 @@ _res_hconf_reorder_addrs (struct hostent *hp) continue;ifaddrs[new_num_ifs].addrtype = AF_INET;- ifaddrs[new_num_ifs].u.ipv4.addr = - ((struct sockaddr_in *) &cur_ifr->ifr_addr)->sin_addr.s_addr; + ss.sa = &cur_ifr->ifr_addr; + ifaddrs[new_num_ifs].u.ipv4.addr = ss.sin->sin_addr.s_addr;
I'm afraid that's no better than casting. It needs to be a union of contents, not of pointers.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |