about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-28 07:11:00 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-28 07:11:00 +0000
commit4376935c17e692539338f71552da6b24fed0b747 (patch)
tree0ff016d9abeea7d760db1043e2ca810d77477c66 /sysdeps/posix
parent7dfde5a02aca26344ea5d48ce55d67b0eed374a8 (diff)
downloadglibc-4376935c17e692539338f71552da6b24fed0b747.tar.gz
glibc-4376935c17e692539338f71552da6b24fed0b747.tar.xz
glibc-4376935c17e692539338f71552da6b24fed0b747.zip
(gaih_inet): If NAME is a numerical IP address and AI_CANONNAME is set, return copy of NAME as ai_canonname.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 20e60de393..eb45709be1 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -556,6 +556,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	    }
 	  else
 	    return -EAI_ADDRFAMILY;
+
+	dupname:
+	  if (req->ai_flags & AI_CANONNAME)
+	    {
+	      canon = strdup (name);
+	      if (canon == NULL)
+		return -EAI_MEMORY;
+	    }
 	}
 
       if (at->family == AF_UNSPEC)
@@ -603,6 +611,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 			return GAIH_OKIFUNSPEC | -EAI_NONAME;
 		    }
 		}
+
+	      goto dupname;
 	    }
 	}