From bc5de50bc93360447d3afb001eca8a43a848d7f3 Mon Sep 17 00:00:00 2001 From: markster Date: Mon, 31 May 2004 19:40:23 +0000 Subject: More BSD compile fixes (bugs #1754 and #1756) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3121 f38db490-d61c-443f-a65b-d21fe96a405b --- dns.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dns.c') diff --git a/dns.c b/dns.c index 33974aa14..0ec7d6d51 100755 --- a/dns.c +++ b/dns.c @@ -154,8 +154,11 @@ static int dns_parse_answer(void *context, #if defined(res_ninit) #define HAS_RES_NINIT #else +static ast_mutex_t res_lock = AST_MUTEX_INITIALIZER; +#if 0 #warning "Warning, res_ninit is missing... Could have reentrancy issues" #endif +#endif int ast_search_dns(void *context, const char *dname, int class, int type, @@ -171,6 +174,7 @@ int ast_search_dns(void *context, res_ninit(&dnsstate); res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer)); #else + ast_mutex_lock(&res_lock); res_init(); res = res_search(dname, class, type, answer, sizeof(answer)); #endif @@ -192,6 +196,7 @@ int ast_search_dns(void *context, #ifndef __APPLE__ res_close(); #endif + ast_mutex_unlock(&res_lock); #endif return ret; } -- cgit v1.2.3