Browse code

support Windows SFU

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@636 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/06/27 16:22:19
Showing 13 changed files
... ...
@@ -113,6 +113,7 @@ Ed Phillips <ed*UDel.Edu>
113 113
 Andreas Piesk <Andreas.Piesk*heise.de>
114 114
 Ant La Porte <ant*dvere.net>
115 115
 Thomas Quinot <thomas*cuivre.fr.eu.org>
116
+Brian A. Reiter <breiter*wolfereiter.com>
116 117
 Hector M. Rulot Segovia <Hector.Rulot*uv.es>
117 118
 David Santinoli <david*santinoli.com>
118 119
 Vijay Sarvepalli <vssarvep*office.uncg.edu>
... ...
@@ -1,3 +1,7 @@
1
+Sun Jun 27 09:12:29 CEST 2004 (tk)
2
+----------------------------------
3
+  * support Windows SFU (thanks to Brian A. Reiter <breiter*wolfereiter.com>)
4
+
1 5
 Sat Jun 26 14:17:11 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/message.c:	Added missing newline from the end of the
... ...
@@ -52,7 +56,7 @@ Tue Jun 22 05:09:54 BST 2004 (njh)
52 52
 	emails
53 53
 			Optimise handling of blank lines in emails
54 54
 			Trialing Andrey J. Melnikoff (TEMHOTA)
55
-	<temnota@kmv.ru>'s patch to print stack trace on SIGSEGV. Tidied,
55
+	<temnota*kmv.ru>'s patch to print stack trace on SIGSEGV. Tidied,
56 56
 	optimised and applied the patch. Comments welcome.
57 57
 
58 58
 Tue Jun 22 00:35:38 EDT 2004 (tk)
... ...
@@ -46,7 +46,7 @@ while test $# -gt 0; do
46 46
 	;;
47 47
 
48 48
     --version)
49
-	echo devel-20040622
49
+	echo devel-20040627
50 50
 	exit 0
51 51
 	;;
52 52
 
... ...
@@ -45,6 +45,9 @@
45 45
 /* os is hpux */
46 46
 #undef C_HPUX
47 47
 
48
+/* os is interix */
49
+#undef C_INTERIX
50
+
48 51
 /* os is irix */
49 52
 #undef C_IRIX
50 53
 
... ...
@@ -35,6 +35,12 @@
35 35
 #include <sys/types.h>
36 36
 #endif
37 37
 
38
+/* submitted by breiter@wolfereiter.com: do not use poll(2) on Interix */
39
+#ifdef C_INTERIX
40
+#undef HAVE_POLL
41
+#undef HAVE_POLL_H
42
+#endif
43
+
38 44
 #if HAVE_POLL
39 45
 #if HAVE_POLL_H
40 46
 #include <poll.h>
... ...
@@ -90,7 +90,10 @@ int dirscan(const char *dirname, const char **virname, unsigned long int *scanne
90 90
 		closedir(dd);
91 91
 		return 1;
92 92
 	    }
93
-	    if(dent->d_ino) {
93
+#ifndef C_INTERIX
94
+	    if(dent->d_ino)
95
+#endif
96
+	    {
94 97
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
95 98
 		    /* build the full name */
96 99
 		    fname = (char *) mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
... ...
@@ -57,7 +57,10 @@ int treewalk(const char *dirname, struct cl_node *root, const struct passwd *use
57 57
 
58 58
     if((dd = opendir(dirname)) != NULL) {
59 59
 	while((dent = readdir(dd))) {
60
-	    if(dent->d_ino) {
60
+#ifndef C_INTERIX
61
+	    if(dent->d_ino)
62
+#endif
63
+	    {
61 64
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
62 65
 		    /* build the full name */
63 66
 		    fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
... ...
@@ -103,7 +106,10 @@ int rmdirs(const char *dirname)
103 103
 	    if(!rmdir(dirname)) break;
104 104
 
105 105
 	    while((dent = readdir(dd))) {
106
-		if(dent->d_ino) {
106
+#ifndef C_INTERIX
107
+		if(dent->d_ino)
108
+#endif
109
+		{
107 110
 		    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
108 111
 			fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
109 112
 			sprintf(fname, "%s/%s", dirname, dent->d_name);
... ...
@@ -201,7 +207,10 @@ int fixperms(const char *dirname)
201 201
 
202 202
     if((dd = opendir(dirname)) != NULL) {
203 203
 	while((dent = readdir(dd))) {
204
-	    if(dent->d_ino) {
204
+#ifndef C_INTERIX
205
+	    if(dent->d_ino)
206
+#endif
207
+	    {
205 208
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
206 209
 		    /* build full name */
207 210
 		    fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
... ...
@@ -244,7 +253,10 @@ int du(const char *dirname, struct s_du *n)
244 244
 
245 245
     if((dd = opendir(dirname)) != NULL) {
246 246
 	while((dent = readdir(dd))) {
247
-	    if(dent->d_ino) {
247
+#ifndef C_INTERIX
248
+	    if(dent->d_ino)
249
+#endif
250
+	    {
248 251
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
249 252
 		    n->files++;
250 253
 
... ...
@@ -11309,7 +11309,32 @@ cat >>confdefs.h <<\_ACEOF
11309 11309
 _ACEOF
11310 11310
 
11311 11311
     ;;
11312
+interix*)
11312 11313
 
11314
+cat >>confdefs.h <<\_ACEOF
11315
+#define C_INTERIX 1
11316
+_ACEOF
11317
+
11318
+    if test "$test_clamav" = "yes"; then
11319
+	if test ! -r /etc/passwd; then
11320
+	   test_clamav="no"
11321
+	fi
11322
+    fi
11323
+    if test "$have_pthreads" = "yes"; then
11324
+	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
11325
+	TH_SAFE="-thread-safe"
11326
+
11327
+cat >>confdefs.h <<\_ACEOF
11328
+#define CL_THREAD_SAFE 1
11329
+_ACEOF
11330
+
11331
+
11332
+cat >>confdefs.h <<\_ACEOF
11333
+#define _REENTRANT 1
11334
+_ACEOF
11335
+
11336
+    fi
11337
+    ;;
11313 11338
 *)
11314 11339
     ;;
11315 11340
 esac
... ...
@@ -356,7 +356,20 @@ irix*)
356 356
     fi
357 357
     AC_DEFINE(C_IRIX,1,[os is irix])
358 358
     ;;
359
-
359
+interix*)
360
+    AC_DEFINE(C_INTERIX,1,[os is interix])
361
+    if test "$test_clamav" = "yes"; then
362
+	if test ! -r /etc/passwd; then
363
+	   test_clamav="no"
364
+	fi
365
+    fi
366
+    if test "$have_pthreads" = "yes"; then
367
+	LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
368
+	TH_SAFE="-thread-safe"
369
+	AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
370
+	AC_DEFINE(_REENTRANT,1,[thread safe])
371
+    fi
372
+    ;;
360 373
 *)
361 374
     ;;
362 375
 esac
... ...
@@ -351,7 +351,10 @@ int cli_rmdirs(const char *dirname)
351 351
 	    if(!rmdir(dirname)) break;
352 352
 
353 353
 	    while((dent = readdir(dd))) {
354
-		if(dent->d_ino) {
354
+#ifndef C_INTERIX
355
+		if(dent->d_ino)
356
+#endif
357
+		{
355 358
 		    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
356 359
 			fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
357 360
 			sprintf(fname, "%s/%s", dirname, dent->d_name);
... ...
@@ -239,7 +239,10 @@ int cl_loaddbdir(const char *dirname, struct cl_node **root, int *virnum)
239 239
     cli_dbgmsg("Loading databases from %s\n", dirname);
240 240
 
241 241
     while((dent = readdir(dd))) {
242
-	if(dent->d_ino) {
242
+#ifndef C_INTERIX
243
+	if(dent->d_ino)
244
+#endif
245
+	{
243 246
 	    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") &&
244 247
 	    (cli_strbcasestr(dent->d_name, ".db")  ||
245 248
 	     cli_strbcasestr(dent->d_name, ".db2") ||
... ...
@@ -292,7 +295,10 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
292 292
     cli_dbgmsg("Stat()ing files in %s\n", dirname);
293 293
 
294 294
     while((dent = readdir(dd))) {
295
-	if(dent->d_ino) {
295
+#ifndef C_INTERIX
296
+	if(dent->d_ino)
297
+#endif
298
+	{
296 299
 	    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && (cli_strbcasestr(dent->d_name, ".db") || cli_strbcasestr(dent->d_name, ".db2") || cli_strbcasestr(dent->d_name, ".cvd"))) {
297 300
 
298 301
 		dbstat->no++;
... ...
@@ -331,7 +337,10 @@ int cl_statchkdir(const struct cl_stat *dbstat)
331 331
     cli_dbgmsg("Stat()ing files in %s\n", dbstat->dir);
332 332
 
333 333
     while((dent = readdir(dd))) {
334
-	if(dent->d_ino) {
334
+#ifndef C_INTERIX
335
+	if(dent->d_ino)
336
+#endif
337
+	{
335 338
 	    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && (cli_strbcasestr(dent->d_name, ".db") || cli_strbcasestr(dent->d_name, ".db2") || cli_strbcasestr(dent->d_name, ".cvd"))) {
336 339
 
337 340
                 fname = cli_calloc(strlen(dbstat->dir) + strlen(dent->d_name) + 2, sizeof(char));
... ...
@@ -780,7 +780,10 @@ static int cli_scandir(const char *dirname, const char **virname, long int *scan
780 780
 
781 781
     if((dd = opendir(dirname)) != NULL) {
782 782
 	while((dent = readdir(dd))) {
783
-	    if(dent->d_ino) {
783
+#ifndef C_INTERIX
784
+	    if(dent->d_ino)
785
+#endif
786
+	    {
784 787
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
785 788
 		    /* build the full name */
786 789
 		    fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
... ...
@@ -911,7 +914,10 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
911 911
 
912 912
     if((dd = opendir(dirname)) != NULL) {
913 913
 	while((dent = readdir(dd))) {
914
-	    if(dent->d_ino) {
914
+#ifndef C_INTERIX
915
+	    if(dent->d_ino)
916
+#endif
917
+	    {
915 918
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
916 919
 		    /* build the full name */
917 920
 		    fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
... ...
@@ -978,7 +978,10 @@ int listdir(const char *dirname)
978 978
     }
979 979
 
980 980
     while((dent = readdir(dd))) {
981
-	if(dent->d_ino) {
981
+#ifndef C_INTERIX
982
+	if(dent->d_ino)
983
+#endif
984
+	{
982 985
 	    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") &&
983 986
 	    (cli_strbcasestr(dent->d_name, ".db")  ||
984 987
 	     cli_strbcasestr(dent->d_name, ".db2") ||