Fix can't get dns server on macos and ios (#401)

If DNS configuration didn't include search domains on MacOS (or iOS) it would throw an error instead of ignoring.

Fix By: @halx99
pull/406/head
HALX99 4 years ago committed by GitHub
parent fd890e9246
commit 809d5e84f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/lib/ares_init.c

@ -1665,7 +1665,7 @@ static int init_by_resolv_conf(ares_channel channel)
int entries = 0; int entries = 0;
while ((entries < MAXDNSRCH) && res.dnsrch[entries]) while ((entries < MAXDNSRCH) && res.dnsrch[entries])
entries++; entries++;
if(entries) {
channel->domains = ares_malloc(entries * sizeof(char *)); channel->domains = ares_malloc(entries * sizeof(char *));
if (!channel->domains) { if (!channel->domains) {
status = ARES_ENOMEM; status = ARES_ENOMEM;
@ -1679,6 +1679,7 @@ static int init_by_resolv_conf(ares_channel channel)
} }
} }
} }
}
if (channel->ndots == -1) if (channel->ndots == -1)
channel->ndots = res.ndots; channel->ndots = res.ndots;
if (channel->tries == -1) if (channel->tries == -1)

Loading…
Cancel
Save