(Aerror): Fix printing IP address.
authordrepper <drepper>
Mon, 22 Aug 2005 04:04:08 +0000 (04:04 +0000)
committerdrepper <drepper>
Mon, 22 Aug 2005 04:04:08 +0000 (04:04 +0000)
resolv/res_send.c

index 86c4f1e..e62cde2 100644 (file)
@@ -1062,8 +1062,13 @@ Aerror(const res_state statp, FILE *file, const char *string, int error,
 
                fprintf(file, "res_send: %s ([%s].%u): %s\n",
                        string,
-                       inet_ntop(address->sa_family, address->sa_data,
-                                 tmp, sizeof tmp),
+                       (address->sa_family == AF_INET
+                        ? inet_ntop(address->sa_family,
+                                    &((const struct sockaddr_in *) address)->sin_addr,
+                                    tmp, sizeof tmp)
+                        : inet_ntop(address->sa_family,
+                                    &((const struct sockaddr_in6 *) address)->sin6_addr,
+                                    tmp, sizeof tmp)),
                        (address->sa_family == AF_INET
                         ? ntohs(((struct sockaddr_in *) address)->sin_port)
                         : address->sa_family == AF_INET6