diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2014-02-16 12:59:23 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-09-05 22:44:08 +1000 |
commit | 3a4f226eaf6aff5529711f7fa3885a1cec815c32 (patch) | |
tree | b1d748f461e763e9139cc3e7256c106f7b9be5a5 /resolv | |
parent | efbeb31ba5277132b683011714f8e77bc2156aa2 (diff) | |
download | glibc-3a4f226eaf6aff5529711f7fa3885a1cec815c32.tar.gz glibc-3a4f226eaf6aff5529711f7fa3885a1cec815c32.tar.xz glibc-3a4f226eaf6aff5529711f7fa3885a1cec815c32.zip |
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. (cherry picked from commit ab7ac0f2cf8731fe4c3f3aea6088a7c0127b5725)
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/nss_dns/dns-host.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index f56dd3584a..71b3b96ca5 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -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, host_buffer.buf->buf, anslen, &host_buffer.ptr, &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) { @@ -342,17 +348,8 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, *errnop = EAGAIN; else __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. */ if (host_buffer.buf != orig_host_buffer) anslen = MAXPACKET; |