summary refs log tree commit diff
path: root/nss/getent.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-15 10:48:29 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-15 10:48:29 +0000
commita691b2172546d5851ad4c0b696061c321dd700d5 (patch)
tree22cc8ccff8eb2a96e9902ba3b46eb7c936d508b1 /nss/getent.c
parenta7d248330fcfbd8c3ebaf13088d9d312895b7dc4 (diff)
downloadglibc-a691b2172546d5851ad4c0b696061c321dd700d5.tar.gz
glibc-a691b2172546d5851ad4c0b696061c321dd700d5.tar.xz
glibc-a691b2172546d5851ad4c0b696061c321dd700d5.zip
Update.
	* nss/getent.c (ahosts_keys_int): Correctly print IPv6 addresses.
Diffstat (limited to 'nss/getent.c')
-rw-r--r--nss/getent.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nss/getent.c b/nss/getent.c
index 0f93e5121c..45a6a1ffe5 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -345,7 +345,9 @@ ahosts_keys_int (int af, int xflags, int number, char *key[])
 	      char buf[INET6_ADDRSTRLEN];
 	      printf ("%-15s %-6s %s\n",
 		      inet_ntop (runp->ai_family,
-				 &((struct sockaddr_in *) runp->ai_addr)->sin_addr,
+				 runp->ai_family == AF_INET
+				 ? (void *) &((struct sockaddr_in *) runp->ai_addr)->sin_addr
+				 : (void *) &((struct sockaddr_in6 *) runp->ai_addr)->sin6_addr,
 				 buf, sizeof (buf)),
 		      sockstr,
 		      runp->ai_canonname ?: "");