about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--nss/getent.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f809ef8c1e..5b6b668173 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-08-13  Ulrich Drepper  <drepper@redhat.com>
 
+	* nss/getent.c (ahosts_keys): ai_canonname is NULL for all but the
+	first returned entry.  Print name only if not NULL.
+
 	* nis/nss_nis/nis-netgrp.c: Remove locking by using data in struct
 	__netgrent object passed in instead of global variables.
 	Optimize.
diff --git a/nss/getent.c b/nss/getent.c
index bcc363dccf..4be9535b9d 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -348,7 +348,7 @@ ahosts_keys (int number, char *key[])
 				 &((struct sockaddr_in *) runp->ai_addr)->sin_addr,
 				 buf, sizeof (buf)),
 		      sockstr,
-		      runp->ai_canonname);
+		      runp->ai_canonname ?: "");
 
 	      runp = runp->ai_next;
 	    }