Browse code

fix several problems introduced by the win32 commits

aCaB authored on 2009/09/25 07:09:13
Showing 18 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Sep 25 00:31:29 CEST 2009 (acab)
2
+------------------------------------
3
+ * fix several problems introduced by the win32 commits
4
+   many thanks edwin and sherpya
5
+
1 6
 Thu Sep 24 19:43:50 CEST 2009 (acab)
2 7
 ------------------------------------
3 8
  * libclamav/others_common.c: Accept "/" as an absolute path
... ...
@@ -37,6 +37,7 @@
37 37
 
38 38
 #include "shared/optparser.h"
39 39
 #include "shared/output.h"
40
+#include "shared/misc.h"
40 41
 
41 42
 #include "connpool.h"
42 43
 #include "netcode.h"
... ...
@@ -103,8 +103,11 @@ static	char	const	rcsid[] = "$Id: binhex.c,v 1.23 2007/02/12 20:46:08 njh Exp $"
103 103
 #include <stdio.h>
104 104
 #include <memory.h>
105 105
 #include <sys/stat.h>
106
-#include "others.h"
106
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
107
+#include <sys/mman.h>
108
+#endif
107 109
 
110
+#include "others.h"
108 111
 #include "mbox.h"
109 112
 #include "binhex.h"
110 113
 
... ...
@@ -31,6 +31,9 @@
31 31
 #ifdef	HAVE_UNISTD_H
32 32
 #include <unistd.h>
33 33
 #endif
34
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
35
+#include <sys/mman.h>
36
+#endif
34 37
 #include <string.h>
35 38
 
36 39
 #include "others.h"
... ...
@@ -39,6 +39,9 @@
39 39
 #include <errno.h>
40 40
 #include <stdio.h>
41 41
 #include <ctype.h>
42
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
43
+#include <sys/mman.h>
44
+#endif
42 45
 
43 46
 #include "others.h"
44 47
 #include "htmlnorm.h"
... ...
@@ -39,6 +39,9 @@
39 39
 #if HAVE_STRINGS_H
40 40
 #include <strings.h>
41 41
 #endif
42
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
43
+#include <sys/mman.h>
44
+#endif
42 45
 #include <zlib.h>
43 46
 
44 47
 #include "scanners.h"
... ...
@@ -33,7 +33,6 @@ CLAMAV_PUBLIC {
33 33
 CLAMAV_PRIVATE {
34 34
   global:
35 35
     cli_gettmpdir;
36
-    cli_is_abspath;
37 36
     cli_strtok;
38 37
     cli_strtokenize;
39 38
     cli_cvdunpack;
... ...
@@ -35,6 +35,9 @@
35 35
 #if HAVE_STRING_H
36 36
 #include <string.h>
37 37
 #endif
38
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
39
+#include <sys/mman.h>
40
+#endif
38 41
 #include <stddef.h>
39 42
 
40 43
 #include "others.h"
... ...
@@ -30,6 +30,9 @@
30 30
 #ifdef HAVE_UNISTD_H
31 31
 #include <unistd.h>
32 32
 #endif
33
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
34
+#include <sys/mman.h>
35
+#endif
33 36
 
34 37
 #include "others.h"
35 38
 #include "cltypes.h"
... ...
@@ -34,6 +34,9 @@
34 34
 #endif
35 35
 #include <ctype.h>
36 36
 #include <stdlib.h>
37
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
38
+#include <sys/mman.h>
39
+#endif
37 40
 #include "clamav.h"
38 41
 
39 42
 #include "cltypes.h"
... ...
@@ -398,7 +398,6 @@ int cli_updatelimits(cli_ctx *, unsigned long);
398 398
 unsigned long cli_getsizelimit(cli_ctx *, unsigned long);
399 399
 int cli_matchregex(const char *str, const char *regex);
400 400
 void cli_qsort(void *basep, size_t nelems, size_t size, int (*comp)(const void *, const void *));
401
-int cli_is_abspath(const char *path);
402 401
 
403 402
 /* symlink behaviour */
404 403
 #define CLI_FTW_FOLLOW_FILE_SYMLINK 0x01
... ...
@@ -910,13 +910,3 @@ void cli_qsort(void *basep, size_t nelems, size_t size, int (*comp)(const void *
910 910
 	}
911 911
     }
912 912
 }
913
-
914
-int cli_is_abspath(const char *path) {
915
-#ifdef _WIN32
916
-    int len = strlen(path);
917
-    return (len > 2 && path[0] == '\\' && path[1] == '\\') || (len > 3 && path[1] == ':' && path[2] == '\\');
918
-#else
919
-    return *path == '/';
920
-#endif
921
-}
922
-
... ...
@@ -41,7 +41,9 @@ static	char	const	rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $";
41 41
 #ifdef	HAVE_UNISTD_H
42 42
 #include <unistd.h>
43 43
 #endif
44
-
44
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
45
+#include <sys/mman.h>
46
+#endif
45 47
 #include <zlib.h>
46 48
 
47 49
 #include "clamav.h"
... ...
@@ -30,6 +30,7 @@
30 30
 #endif
31 31
 #include <string.h>
32 32
 #include <ctype.h>
33
+#include <netinet/in.h>
33 34
 #include "clamav.h"
34 35
 #include "others.h"
35 36
 #include "cltypes.h"
... ...
@@ -35,6 +35,9 @@
35 35
 #endif
36 36
 #include <stdlib.h>
37 37
 #include <stdio.h>
38
+#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
39
+#include <sys/mman.h>
40
+#endif
38 41
 
39 42
 #include <zlib.h>
40 43
 #include "inflate64.h"
... ...
@@ -33,7 +33,3 @@ typedef	unsigned	int	in_addr_t;
33 33
 #else
34 34
 #define PATHSEP "/"
35 35
 #endif
36
-
37
-#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
38
-#include <sys/mman.h>
39
-#endif
... ...
@@ -316,3 +316,11 @@ int cfg_tcpsock(const struct optstruct *opts, struct sockaddr_in *tcpsock, in_ad
316 316
     return 0;
317 317
 }
318 318
 
319
+int cli_is_abspath(const char *path) {
320
+#ifdef _WIN32
321
+    int len = strlen(path);
322
+    return (len > 2 && path[0] == '\\' && path[1] == '\\') || (len > 3 && path[1] == ':' && path[2] == '\\');
323
+#else
324
+    return *path == '/';
325
+#endif
326
+}
... ...
@@ -54,4 +54,6 @@ int daemonize(void);
54 54
 const char *get_version(void);
55 55
 int match_regex(const char *filename, const char *pattern);
56 56
 int cfg_tcpsock(const struct optstruct *opts, struct sockaddr_in *server, in_addr_t defaultbind);
57
+int cli_is_abspath(const char *path);
58
+
57 59
 #endif