mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-09 10:50:08 +00:00
(gaih_inet): Really set ai_canonname only in one entry.
This commit is contained in:
parent
913e79f5da
commit
862275809d
@ -664,7 +664,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
no_more = __nss_database_lookup ("hosts", NULL,
|
no_more = __nss_database_lookup ("hosts", NULL,
|
||||||
"dns [!UNAVAIL=return] files", &nip);
|
"dns [!UNAVAIL=return] files",
|
||||||
|
&nip);
|
||||||
|
|
||||||
if (__res_maybe_init (&_res, 0) == -1)
|
if (__res_maybe_init (&_res, 0) == -1)
|
||||||
no_more = 1;
|
no_more = 1;
|
||||||
@ -939,11 +940,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
|||||||
memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero));
|
memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c)
|
if (namelen != 0)
|
||||||
{
|
{
|
||||||
(*pai)->ai_canonname = ((void *) (*pai) +
|
(*pai)->ai_canonname = ((void *) (*pai) +
|
||||||
sizeof (struct addrinfo) + socklen);
|
sizeof (struct addrinfo) + socklen);
|
||||||
strcpy ((*pai)->ai_canonname, c);
|
strcpy ((*pai)->ai_canonname, c);
|
||||||
|
|
||||||
|
/* We do not need to allocate the canonical name anymore. */
|
||||||
|
namelen = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
(*pai)->ai_canonname = NULL;
|
(*pai)->ai_canonname = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user