diff options
author | Yu Jiung <jiung.yu@samsung.com> | 2016-11-09 11:18:45 +0900 |
---|---|---|
committer | Yu Jiung <jiung.yu@samsung.com> | 2016-11-09 11:18:55 +0900 |
commit | eb886f120599b2a184db20b527db6dfdfcb7852e (patch) | |
tree | b49d8075742c4a27b237fa183cb68670e421d398 /acountry.c | |
parent | b6627e2c19506bd30328969ea8aab73fa0945f36 (diff) | |
download | c-ares-eb886f120599b2a184db20b527db6dfdfcb7852e.tar.gz c-ares-eb886f120599b2a184db20b527db6dfdfcb7852e.tar.bz2 c-ares-eb886f120599b2a184db20b527db6dfdfcb7852e.zip |
Imported Upstream version 1.11.0upstream/1.11.0
Change-Id: I238c24b75a10aa902d9bc4076ed68b76b5e2a750
Diffstat (limited to 'acountry.c')
-rw-r--r-- | acountry.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -71,8 +71,8 @@ static const char *usage = "acountry [-vh?] {host|addr} ...\n"; static const char nerd_fmt[] = "%u.%u.%u.%u.zz.countries.nerd.dk"; -static const char *nerd_ver1 = nerd_fmt + 14; -static const char *nerd_ver2 = nerd_fmt + 11; +static const char *nerd_ver1 = nerd_fmt + 14; /* .countries.nerd.dk */ +static const char *nerd_ver2 = nerd_fmt + 11; /* .zz.countries.nerd.dk */ static int verbose = 0; #define TRACE(fmt) do { \ @@ -200,7 +200,9 @@ static void wait_ares(ares_channel channel) if (nfds == 0) break; tvp = ares_timeout(channel, NULL, &tv); - select(nfds, &read_fds, &write_fds, NULL, tvp); + nfds = select(nfds, &read_fds, &write_fds, NULL, tvp); + if (nfds < 0) + continue; ares_process(channel, &read_fds, &write_fds); } } @@ -559,9 +561,10 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) if (ver_1) { const char *dot = strchr(cname, '.'); - if ((z0 != 'z' && z1 != 'z') || dot != cname+4) + if (dot != cname+4) { printf("Unexpected CNAME %s (ver_1)\n", cname); + free(ccopy); return; } } @@ -572,12 +575,14 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) if (z0 != 'z' && z1 != 'z') { printf("Unexpected CNAME %s (ver_2)\n", cname); + free(ccopy); return; } } else { printf("Unexpected CNAME %s (ver?)\n", cname); + free(ccopy); return; } @@ -614,4 +619,3 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) } free(ccopy); } - |