(gaih_inet): If NAME is a numerical IP address and AI_CANONNAME is set, return copy of NAME as ai_canonname.

This commit is contained in:
Ulrich Drepper 2004-09-28 07:11:00 +00:00
parent 7dfde5a02a
commit 4376935c17
1 changed files with 10 additions and 0 deletions

View 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;
}
}