]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(gaih_inet): If NAME is a numerical IP address and AI_CANONNAME is set, return copy...
authorUlrich Drepper <drepper@redhat.com>
Tue, 28 Sep 2004 07:11:00 +0000 (07:11 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 28 Sep 2004 07:11:00 +0000 (07:11 +0000)
sysdeps/posix/getaddrinfo.c

index 20e60de39337f56242698d1dd3343c21dd21786f..eb45709be1c47ab9ea1e6c990826f6eaec00bf7c 100644 (file)
@@ -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;
            }
        }