On 04/22/2010 02:33 PM, Matthias Bolte wrote: >> + char ip[INET6_ADDRSTRLEN]; >> + >> + if (inet_ntop(sa->sa_family, >> + (sa->sa_family == AF_INET >> + ? (void *)&((struct sockaddr_in *)sa)->sin_addr >> + : (void *)&((struct sockaddr_in6 *)sa)->sin6_addr), > > Could we avoid this void * cast? The same cast is in > src/remote/remote_driver.c too.
Yeah, I thought it was pretty ugly; gcc is (rightfully) complaining
(which in turn failed with -Werror) that sin_addr and sin6_addr are
different types, and therefore warned that the ?: had issues without at
least one of the two casts to void*. I pushed, after dropping ?: and
instead using:
void *rawaddr;
if (sa->sa_family == AF_INET)
rawaddr = &((struct sockaddr_in *)sa)->sin_addr;
else
rawaddr = &((struct sockaddr_in6 *)sa)->sin6_addr;
if (inet_ntop(sa->sa_family, rawaddr, ip, sizeof ip)) {
> ACK.
Thanks.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
