mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-26 06:50:07 +00:00
Deduplicate resolv/nss_dns/dns-host.c
In resolv/nss_dns/dns-host.c one of code path duplicated code after that. We merge these paths.
This commit is contained in:
parent
c70a4b1db0
commit
ab7ac0f2cf
@ -315,7 +315,13 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
|
|||||||
int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC,
|
int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC,
|
||||||
host_buffer.buf->buf, anslen, &host_buffer.ptr,
|
host_buffer.buf->buf, anslen, &host_buffer.ptr,
|
||||||
&ans2p, &nans2p, &resplen2);
|
&ans2p, &nans2p, &resplen2);
|
||||||
if (n < 0)
|
if (n >= 0)
|
||||||
|
{
|
||||||
|
status = gaih_getanswer (host_buffer.buf, n, (const querybuf *) ans2p,
|
||||||
|
resplen2, name, pat, buffer, buflen,
|
||||||
|
errnop, herrnop, ttlp);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
switch (errno)
|
switch (errno)
|
||||||
{
|
{
|
||||||
@ -342,17 +348,8 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
|
|||||||
*errnop = EAGAIN;
|
*errnop = EAGAIN;
|
||||||
else
|
else
|
||||||
__set_errno (olderr);
|
__set_errno (olderr);
|
||||||
|
|
||||||
if (host_buffer.buf != orig_host_buffer)
|
|
||||||
free (host_buffer.buf);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = gaih_getanswer(host_buffer.buf, n, (const querybuf *) ans2p,
|
|
||||||
resplen2, name, pat, buffer, buflen,
|
|
||||||
errnop, herrnop, ttlp);
|
|
||||||
|
|
||||||
/* Check whether ans2p was separately allocated. */
|
/* Check whether ans2p was separately allocated. */
|
||||||
if (host_buffer.buf != orig_host_buffer)
|
if (host_buffer.buf != orig_host_buffer)
|
||||||
anslen = MAXPACKET;
|
anslen = MAXPACKET;
|
||||||
|
Loading…
Reference in New Issue
Block a user