git-svn-id: file:///var/lib/svn/clamav-devel/branches/0.93@3852 77e5149b-7576-45b1-b177-96237e5ba77b
Török Edvin authored on 2008/05/15 02:50:31... | ... |
@@ -4456,6 +4456,9 @@ my_r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t l |
4456 | 4456 |
{ |
4457 | 4457 |
struct hostent *hp2; |
4458 | 4458 |
int ret = -1; |
4459 |
+#ifdef CL_THREAD_SAFE |
|
4460 |
+ static pthread_mutex_t hostent_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
4461 |
+#endif |
|
4459 | 4462 |
|
4460 | 4463 |
if((hostname == NULL) || (hp == NULL)) |
4461 | 4464 |
return -1; |
... | ... |
@@ -4480,9 +4483,8 @@ my_r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t l |
4480 | 4480 |
return h_errno; |
4481 | 4481 |
#else |
4482 | 4482 |
/* Single thread the code e.g. VS2005 */ |
4483 |
-#ifdef CL_THREAD_SAFE |
|
4484 |
- static pthread_mutex_t hostent_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
4485 | 4483 |
|
4484 |
+#ifdef CL_THREAD_SAFE |
|
4486 | 4485 |
pthread_mutex_lock(&hostent_mutex); |
4487 | 4486 |
#endif |
4488 | 4487 |
if((hp2 = gethostbyname(hostname)) == NULL) { |
... | ... |
@@ -62,6 +62,9 @@ int r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t |
62 | 62 |
{ |
63 | 63 |
struct hostent *hp2; |
64 | 64 |
int ret = -1; |
65 |
+#ifdef CL_THREAD_SAFE |
|
66 |
+ static pthread_mutex_t hostent_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
67 |
+#endif |
|
65 | 68 |
|
66 | 69 |
if((hostname == NULL) || (hp == NULL)) |
67 | 70 |
return -1; |
... | ... |
@@ -81,8 +84,6 @@ int r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t |
81 | 81 |
#else |
82 | 82 |
/* Single thread the code e.g. VS2005 */ |
83 | 83 |
#ifdef CL_THREAD_SAFE |
84 |
- static pthread_mutex_t hostent_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
85 |
- |
|
86 | 84 |
pthread_mutex_lock(&hostent_mutex); |
87 | 85 |
#endif |
88 | 86 |
if((hp2 = gethostbyname(hostname)) == NULL) { |