summaryrefslogtreecommitdiff
path: root/acountry.c
diff options
context:
space:
mode:
authorYu Jiung <jiung.yu@samsung.com>2016-11-09 11:18:45 +0900
committerYu Jiung <jiung.yu@samsung.com>2016-11-09 11:18:55 +0900
commiteb886f120599b2a184db20b527db6dfdfcb7852e (patch)
treeb49d8075742c4a27b237fa183cb68670e421d398 /acountry.c
parentb6627e2c19506bd30328969ea8aab73fa0945f36 (diff)
downloadc-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.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/acountry.c b/acountry.c
index 210ef84..e157702 100644
--- a/acountry.c
+++ b/acountry.c
@@ -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);
}
-