Check if DNS server has been initialized before trying to lookup the server address in the cache. From Librae

This commit is contained in:
Librae 2015-07-27 14:16:45 -06:00 committed by Gregory Nutt
parent e66e2f5c0f
commit dce921c1cd

View File

@ -1029,6 +1029,14 @@ int dns_find_answer(FAR const char *hostname, FAR struct sockaddr *addr,
int next;
int ndx;
/* If DNS not initialized, no need to proceed */
if (!g_dns_initialized)
{
ndbg("ERROR: DNS not initialized yet\n");
return -EAGAIN;
}
/* Get exclusive access to the DNS cache */
dns_semtake();