Jacek Caban : iphlpapi: Protect res_init call with critical section.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jul 2 15:19:15 CDT 2014
Module: wine
Branch: master
Commit: ef1342bae711aa798f5fa6e5cb9260237395b304
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ef1342bae711aa798f5fa6e5cb9260237395b304
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Jul 1 17:00:36 2014 +0200
iphlpapi: Protect res_init call with critical section.
---
dlls/iphlpapi/iphlpapi_main.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 8c55048..70a063b 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -1068,10 +1068,21 @@ static void sockaddr_in6_to_WS_storage( SOCKADDR_STORAGE *dst, const struct sock
#ifdef HAVE_STRUCT___RES_STATE
/* call res_init() just once because of a bug in Mac OS X 10.4 */
/* Call once per thread on systems that have per-thread _res. */
+
+static CRITICAL_SECTION res_init_cs;
+static CRITICAL_SECTION_DEBUG res_init_cs_debug = {
+ 0, 0, &res_init_cs,
+ { &res_init_cs_debug.ProcessLocksList, &res_init_cs_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": res_init_cs") }
+};
+static CRITICAL_SECTION res_init_cs = { &res_init_cs_debug, -1, 0, 0, 0, 0 };
+
static void initialise_resolver(void)
{
+ EnterCriticalSection(&res_init_cs);
if ((_res.options & RES_INIT) == 0)
res_init();
+ LeaveCriticalSection(&res_init_cs);
}
static int get_dns_servers( SOCKADDR_STORAGE *servers, int num, BOOL ip4_only )
More information about the wine-cvs
mailing list