diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-26 13:32:57 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-26 13:32:57 +0000 |
commit | 9b7f14da2b5a93967a557131a367440fd59a8e95 (patch) | |
tree | 1194b39692b711670ee45aebaf26209cef87ba42 /dns.c | |
parent | aaa8873a106ef1e6e18751e25444e19b1e632142 (diff) |
Unify all the res_ninit patches
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2778 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'dns.c')
-rwxr-xr-x | dns.c | 27 |
1 files changed, 12 insertions, 15 deletions
@@ -151,24 +151,25 @@ static int dns_parse_answer(void *context, return 0; } +#if defined(res_ninit) +#define HAS_RES_NINIT +#else +#warning "Warning, res_ninit is missing... Could have reentrancy issues" +#endif + int ast_search_dns(void *context, const char *dname, int class, int type, int (*callback)(void *context, u_char *answer, int len, u_char *fullanswer)) { -#ifdef linux +#ifdef HAS_RES_NINIT struct __res_state dnsstate; #endif char answer[MAX_SIZE]; int res, ret = -1; -#ifdef linux - #ifndef __UCLIBC__ - res_ninit(&dnsstate); - res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer)); - #else - res_init(); - res = res_search(dname, class, type, answer, sizeof(answer)); - #endif +#ifdef HAS_RES_NINIT + res_ninit(&dnsstate); + res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer)); #else res_init(); res = res_search(dname, class, type, answer, sizeof(answer)); @@ -185,12 +186,8 @@ int ast_search_dns(void *context, else ret = 1; } -#if defined(linux) - #ifndef __UCLIBC__ - res_nclose(&dnsstate); - #else - res_close(); - #endif +#ifdef HAS_RES_NINIT + res_nclose(&dnsstate); #else #ifndef __APPLE__ res_close(); |