Browse code

merge win32 patches from NJH

git-svn: trunk@2866

Tomasz Kojm authored on 2007/02/25 22:14:21
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sun Feb 25 12:18:42 CET 2007 (tk)
2
+---------------------------------
3
+  * libclamav/readdb.c,lockdb.c: merge win32 patches from NJH
4
+
1 5
 Sun Feb 25 01:58:55 CET 2007 (tk)
2 6
 ---------------------------------
3 7
   * clamscan: merge win32 patches from NJH
... ...
@@ -64,6 +64,10 @@ pthread_mutex_t lock_mutex = PTHREAD_MUTEX_INITIALIZER;
64 64
 #define pthread_mutex_unlock(arg)
65 65
 #endif
66 66
 
67
+#ifdef C_WINDOWS /* FIXME */
68
+#define DONT_LOCK_DBDIRS
69
+#endif
70
+
67 71
 struct dblock {
68 72
 	struct dblock *lock_link;
69 73
 	char lock_file[NAME_MAX];
... ...
@@ -17,6 +17,10 @@
17 17
  *  MA 02110-1301, USA.
18 18
  */
19 19
 
20
+#ifdef _MSC_VER
21
+#include <winsock.h> /* for Sleep() */
22
+#endif
23
+
20 24
 #if HAVE_CONFIG_H
21 25
 #include "clamav-config.h"
22 26
 #endif
... ...
@@ -28,7 +32,7 @@
28 28
 #ifdef	HAVE_UNISTD_H
29 29
 #include <unistd.h>
30 30
 #endif
31
-#ifndef	C_WINDOWS
31
+#ifndef C_WINDOWS
32 32
 #include <dirent.h>
33 33
 #endif
34 34
 #include <sys/types.h>
... ...
@@ -1319,7 +1323,11 @@ static int cli_loaddbdir(const char *dirname, struct cl_engine **engine, unsigne
1319 1319
 
1320 1320
     cli_dbgmsg("cli_loaddbdir: Acquiring dbdir lock\n");
1321 1321
     while((lock = cli_readlockdb(dirname, 0)) == CL_ELOCKDB) {
1322
+#ifdef C_WINDOWS
1323
+	Sleep(5);
1324
+#else
1322 1325
 	sleep(5);
1326
+#endif
1323 1327
 	if(try++ > 24) {
1324 1328
 	    cli_errmsg("cl_load(): Unable to lock database directory: %s\n", dirname);
1325 1329
 	    return CL_ELOCKDB;