[Asterisk-cvs] asterisk dns.c,1.7,1.8

markster at lists.digium.com markster at lists.digium.com
Mon May 31 15:24:29 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv9948

Modified Files:
	dns.c 
Log Message:
More BSD compile fixes (bugs #1754 and #1756)


Index: dns.c
===================================================================
RCS file: /usr/cvsroot/asterisk/dns.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dns.c	26 Apr 2004 13:32:57 -0000	1.7
+++ dns.c	31 May 2004 19:40:22 -0000	1.8
@@ -154,8 +154,11 @@
 #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 @@
 	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 @@
 #ifndef __APPLE__
 	res_close();
 #endif
+	ast_mutex_unlock(&res_lock);
 #endif
 	return ret;
 }




More information about the svn-commits mailing list