diff --git a/ChangeLog b/ChangeLog index bb67f1b03..5552f9a14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Sep 24 19:22:24 CEST 2009 (acab) +------------------------------------ + * merge a set of win32 patches from Gianluigi Tiesi + Thu Sep 24 19:09:38 CEST 2009 (acab) ------------------------------------ * drop OS/2 "support" diff --git a/clamdscan/clamdscan.c b/clamdscan/clamdscan.c index 6e71ae345..121019d96 100644 --- a/clamdscan/clamdscan.c +++ b/clamdscan/clamdscan.c @@ -26,7 +26,9 @@ #include #include #include +#ifndef _WIN32 #include +#endif #include #include diff --git a/clamdscan/client.c b/clamdscan/client.c index 002f3e9e7..701aadc41 100644 --- a/clamdscan/client.c +++ b/clamdscan/client.c @@ -30,18 +30,20 @@ #include #include #include -#include #ifdef HAVE_SYS_LIMITS_H #include #endif #ifdef HAVE_SYS_SELECT_H #include #endif +#ifndef _WIN32 +#include #include #include #include #include #include +#endif #include #include #include @@ -67,7 +69,9 @@ struct sockaddr *mainsa = NULL; int mainsasz; unsigned long int maxstream; +#ifndef _WIN32 static struct sockaddr_un nixsock; +#endif static struct sockaddr_in tcpsock; diff --git a/clamdscan/proto.c b/clamdscan/proto.c index f37de0787..b359d2851 100644 --- a/clamdscan/proto.c +++ b/clamdscan/proto.c @@ -25,7 +25,9 @@ /* must be first because it may define _XOPEN_SOURCE */ #include "shared/fdpassing.h" #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include #include @@ -33,11 +35,13 @@ #include #include #include -#include #ifdef HAVE_SYS_SELECT_H #include #endif +#ifndef _WIN32 #include +#include +#endif #include "libclamav/others.h" #include "shared/actions.h" diff --git a/clamscan/clamscan.c b/clamscan/clamscan.c index e4e69bdab..91bac140d 100644 --- a/clamscan/clamscan.c +++ b/clamscan/clamscan.c @@ -30,9 +30,7 @@ #ifdef HAVE_UNISTD_H #include #endif -#ifdef C_WINDOWS -#include -#else +#ifndef _WIN32 #include #endif #include @@ -62,14 +60,14 @@ int main(int argc, char **argv) int ds, dms, ret; double mb, rmb; struct timeval t1, t2; -#ifndef C_WINDOWS struct timezone tz; +#ifndef _WIN32 sigset_t sigset; #endif struct optstruct *opts; const struct optstruct *opt; -#if !defined(C_WINDOWS) && !defined(C_BEOS) +#if !defined(_WIN32) && !defined(C_BEOS) sigemptyset(&sigset); sigaddset(&sigset, SIGXFSZ); sigprocmask(SIG_SETMASK, &sigset, NULL); diff --git a/clamscan/manager.c b/clamscan/manager.c index 11e31fdd1..612b0081d 100644 --- a/clamscan/manager.c +++ b/clamscan/manager.c @@ -29,14 +29,10 @@ #include #include #include -#ifdef C_WINDOWS -#include -#else +#include +#ifndef _WIN32 #include #include -#endif -#ifndef C_WINDOWS -#include #include #include #endif @@ -323,7 +319,7 @@ int scanmanager(const struct optstruct *opts) char *file, cwd[1024], *pua_cats = NULL; const char *filename; const struct optstruct *opt; -#ifndef C_WINDOWS +#ifndef _WIN32 struct rlimit rlim; #endif @@ -457,7 +453,7 @@ int scanmanager(const struct optstruct *opts) } } -#ifndef C_WINDOWS +#ifndef _WIN32 if(getrlimit(RLIMIT_FSIZE, &rlim) == 0) { if(rlim.rlim_cur < (rlim_t) cl_engine_get_num(engine, CL_ENGINE_MAX_FILESIZE, NULL)) logg("^System limit for file size is lower than engine->maxfilesize\n"); diff --git a/clamscan/others.c b/clamscan/others.c index b662c81dc..5fb8c5ee7 100644 --- a/clamscan/others.c +++ b/clamscan/others.c @@ -36,7 +36,7 @@ #endif #include #include -#ifndef C_WINDOWS +#ifndef _WIN32 #include #include #endif diff --git a/freshclam/execute.c b/freshclam/execute.c index e1398c4ae..939f93748 100644 --- a/freshclam/execute.c +++ b/freshclam/execute.c @@ -40,9 +40,6 @@ int active_children; void execute( const char *type, const char *text, const struct optstruct *opts ) { int ret; -#ifndef C_WINDOWS - pid_t pid; -#endif if(!optget(opts, "daemon")->enabled) { if(sscanf(text, "EXIT_%d", &ret) == 1) { @@ -65,7 +62,8 @@ void execute( const char *type, const char *text, const struct optstruct *opts ) } else logg("^%s: already %d processes active.\n", type, active_children); #else - if ( active_children #include #include -#ifndef C_WINDOWS +#ifndef _WIN32 #include #endif #include @@ -203,7 +203,7 @@ int main(int argc, char **argv) struct sigaction sigact; struct sigaction oldact; #endif -#ifndef C_WINDOWS +#ifdef HAVE_PWD_H const char *dbowner; struct passwd *user; #endif @@ -256,7 +256,7 @@ int main(int argc, char **argv) #endif } -#ifndef _WIN32 +#ifdef HAVE_PWD_H /* freshclam shouldn't work with root privileges */ dbowner = optget(opts, "DatabaseOwner")->strarg; @@ -419,7 +419,7 @@ int main(int argc, char **argv) logg("#freshclam daemon %s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")\n", get_version()); -#ifdef C_WINDOWS +#ifdef _WIN32 signal(SIGINT, daemon_sighandler); terminate = 0; #else diff --git a/freshclam/manager.c b/freshclam/manager.c index 3173961c2..f14edf9dc 100644 --- a/freshclam/manager.c +++ b/freshclam/manager.c @@ -43,16 +43,14 @@ #include #endif #include -#ifndef C_WINDOWS +#ifndef _WIN32 #include #include #include -#endif -#include -#ifndef C_WINDOWS #include #include #endif +#include #include #include #include diff --git a/freshclam/mirman.c b/freshclam/mirman.c index c971cfae2..7326468c2 100644 --- a/freshclam/mirman.c +++ b/freshclam/mirman.c @@ -20,10 +20,6 @@ #include "clamav-config.h" #endif -#ifdef C_WINDOWS -#define _USE_32BIT_TIME_T /* FIXME: mirdat.atime assumes 32bit time_t */ -#endif - #include #include #include @@ -35,7 +31,7 @@ #include #include -#ifndef C_WINDOWS +#ifndef _WIN32 #include #include #include diff --git a/freshclam/nonblock.c b/freshclam/nonblock.c index cf8e9d67d..4aca47dce 100644 --- a/freshclam/nonblock.c +++ b/freshclam/nonblock.c @@ -29,15 +29,13 @@ #endif #include #include -#ifndef C_WINDOWS +#ifndef _WIN32 #include #include -#endif -#include -#ifndef C_WINDOWS #include #include #endif +#include #include #include #include @@ -46,16 +44,6 @@ #include "shared/output.h" #include "libclamav/clamav.h" -#if (!defined(EALREADY)) && (defined(WSAEALREADY)) -#define EALREADY WSAEALREADY -#endif -#if (!defined(EINPROGRESS)) && (defined(WSAEINPROGRESS)) -#define EINPROGRESS WSAEINPROGRESS -#endif -#if (!defined(EISCONN)) && (defined(WSAEISCONN)) -#define EISCONN WSAEISCONN -#endif - #ifdef SO_ERROR #ifndef timercmp diff --git a/freshclam/nonblock.h b/freshclam/nonblock.h index 3aaca68c0..0209b7a9f 100644 --- a/freshclam/nonblock.h +++ b/freshclam/nonblock.h @@ -24,7 +24,7 @@ #endif #include -#ifndef C_WINDOWS +#ifndef _WIN32 #include #endif diff --git a/freshclam/notify.c b/freshclam/notify.c index d1d7690da..8dfb0054e 100644 --- a/freshclam/notify.c +++ b/freshclam/notify.c @@ -43,7 +43,7 @@ int notify(const char *cfgfile) { char buff[20]; -#ifndef C_WINDOWS +#ifndef _WIN32 struct sockaddr_un server; #endif #ifdef HAVE_GETADDRINFO @@ -66,7 +66,7 @@ int notify(const char *cfgfile) return 1; } -#ifndef C_WINDOWS +#ifndef _WIN32 if((opt = optget(opts, "LocalSocket"))->enabled) { socktype = "UNIX"; server.sun_family = AF_UNIX; diff --git a/libclamav/binhex.c b/libclamav/binhex.c index 52e280d5c..9584ac581 100644 --- a/libclamav/binhex.c +++ b/libclamav/binhex.c @@ -100,14 +100,6 @@ static char const rcsid[] = "$Id: binhex.c,v 1.23 2007/02/12 20:46:08 njh Exp $" #endif #endif -#ifdef HAVE_MMAP -#if HAVE_SYS_MMAN_H -#include -#else /* HAVE_SYS_MMAN_H */ -#undef HAVE_MMAP -#endif -#endif - #include #include #include diff --git a/libclamav/chmunpack.c b/libclamav/chmunpack.c index b2341857c..4494727b4 100644 --- a/libclamav/chmunpack.c +++ b/libclamav/chmunpack.c @@ -33,18 +33,6 @@ #endif #include -#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA) -#if HAVE_MMAP -#if HAVE_SYS_MMAN_H -#include -#else /* HAVE_SYS_MMAN_H */ -#undef HAVE_MMAP -#endif /* HAVE_SYS_MMAN_H */ -#endif /* HAVE_MMAP */ -#else/* PACKED */ -#undef HAVE_MMAP -#endif - #include "others.h" #include "mspack.h" #include "cltypes.h" diff --git a/libclamav/htmlnorm.c b/libclamav/htmlnorm.c index afbdff9fe..bc56c1bd0 100644 --- a/libclamav/htmlnorm.c +++ b/libclamav/htmlnorm.c @@ -40,14 +40,6 @@ #include #include -#if HAVE_MMAP -#if HAVE_SYS_MMAN_H -#include -#else /* HAVE_SYS_MMAN_H */ -#undef HAVE_MMAP -#endif -#endif - #include "others.h" #include "htmlnorm.h" diff --git a/libclamav/ishield.c b/libclamav/ishield.c index 361e93a48..9f3708ed5 100644 --- a/libclamav/ishield.c +++ b/libclamav/ishield.c @@ -32,11 +32,6 @@ #ifdef HAVE_UNISTD_H #include #endif -#if HAVE_MMAP -#ifdef HAVE_SYS_MMAN_H -#include -#endif -#endif /* HAVE_MMAP */ #if HAVE_STRING_H #include #endif diff --git a/libclamav/mbox.c b/libclamav/mbox.c index 3f28cd62a..ce768be71 100644 --- a/libclamav/mbox.c +++ b/libclamav/mbox.c @@ -301,20 +301,8 @@ static pthread_mutex_t tables_mutex = PTHREAD_MUTEX_INITIALIZER; #endif #ifdef NEW_WORLD - #include "matcher.h" - #undef PARTIAL_DIR - -#if HAVE_MMAP -#if HAVE_SYS_MMAN_H -#include -#else /* HAVE_SYS_MMAN_H */ -#undef HAVE_MMAP -#endif -#else /*HAVE_MMAP*/ -#undef NEW_WORLD -#endif #endif #ifdef NEW_WORLD diff --git a/libclamav/mpool.c b/libclamav/mpool.c index 6603f9982..7976562e7 100644 --- a/libclamav/mpool.c +++ b/libclamav/mpool.c @@ -35,7 +35,6 @@ #if HAVE_STRING_H #include #endif -#include #include #include "others.h" diff --git a/libclamav/nsis/nulsft.c b/libclamav/nsis/nulsft.c index f3b73ee24..ffa95ad5e 100644 --- a/libclamav/nsis/nulsft.c +++ b/libclamav/nsis/nulsft.c @@ -31,12 +31,6 @@ #include #endif -#if HAVE_MMAP -#ifdef HAVE_SYS_MMAN_H -#include -#endif -#endif - #include "others.h" #include "cltypes.h" #include "nsis_bzlib.h" diff --git a/libclamav/ole2_extract.c b/libclamav/ole2_extract.c index 66c123a83..510fab3bf 100644 --- a/libclamav/ole2_extract.c +++ b/libclamav/ole2_extract.c @@ -36,14 +36,6 @@ #include #include "clamav.h" -#if HAVE_MMAP -#if HAVE_SYS_MMAN_H -#include -#else /* HAVE_SYS_MMAN_H */ -#undef HAVE_MMAP -#endif -#endif - #include "cltypes.h" #include "others.h" #include "ole2_extract.h" diff --git a/libclamav/pdf.c b/libclamav/pdf.c index e59316b94..fa82218dd 100644 --- a/libclamav/pdf.c +++ b/libclamav/pdf.c @@ -42,16 +42,8 @@ static char const rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $"; #include #endif -#ifdef HAVE_SYS_MMAN_H -#include -#endif - #include -#ifdef C_WINDOWS -#include -#endif - #include "clamav.h" #include "others.h" #include "mbox.h" diff --git a/libclamav/scanners.c b/libclamav/scanners.c index f6d3d2387..492cd381a 100644 --- a/libclamav/scanners.c +++ b/libclamav/scanners.c @@ -35,18 +35,7 @@ #include #endif #include -#ifndef C_WINDOWS #include -#include -#endif - -#if HAVE_MMAP -#if HAVE_SYS_MMAN_H -#include -#else /* HAVE_SYS_MMAN_H */ -#undef HAVE_MMAP -#endif -#endif #define DCONF_ARCH ctx->dconf->archive #define DCONF_DOC ctx->dconf->doc diff --git a/libclamav/special.c b/libclamav/special.c index e50b9cddb..19a6ce39a 100644 --- a/libclamav/special.c +++ b/libclamav/special.c @@ -28,9 +28,6 @@ #ifdef HAVE_UNISTD_H #include #endif -#ifndef C_WINDOWS -#include -#endif #include #include #include "clamav.h" diff --git a/libclamav/unzip.c b/libclamav/unzip.c index 5dbe1dfe3..03ab4f4a7 100644 --- a/libclamav/unzip.c +++ b/libclamav/unzip.c @@ -34,13 +34,6 @@ #include #endif #include - -#if HAVE_MMAP -#ifdef HAVE_SYS_MMAN_H -#include -#endif -#endif /* HAVE_MMAP */ - #include #include diff --git a/platform.h.in b/platform.h.in index ea2b482e4..0c706211d 100644 --- a/platform.h.in +++ b/platform.h.in @@ -34,3 +34,6 @@ typedef unsigned int in_addr_t; #define PATHSEP "/" #endif +#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) +#include +#endif diff --git a/shared/actions.c b/shared/actions.c index 044751de3..94ac195a0 100644 --- a/shared/actions.c +++ b/shared/actions.c @@ -30,7 +30,6 @@ #include #endif #include -#include #include #include diff --git a/shared/misc.c b/shared/misc.c index 60d691ede..40e649630 100644 --- a/shared/misc.c +++ b/shared/misc.c @@ -31,7 +31,9 @@ #include #include #include +#ifndef _WIN32 #include +#endif #include #include #include diff --git a/shared/misc.h b/shared/misc.h index 2cf6df235..7ceabe7df 100644 --- a/shared/misc.h +++ b/shared/misc.h @@ -20,8 +20,10 @@ #ifndef __MISC_H #define __MISC_H +#ifndef _WIN32 #include #include +#endif #include "optparser.h" /* Maximum filenames under various systems - njh */ #ifndef NAME_MAX /* e.g. Linux */ diff --git a/shared/output.c b/shared/output.c index edf29c6b4..02ce0cad4 100644 --- a/shared/output.c +++ b/shared/output.c @@ -34,7 +34,7 @@ #include #include #include -#ifndef C_WINDOWS +#ifndef _WIN32 #include #include #endif diff --git a/sigtool/sigtool.c b/sigtool/sigtool.c index bc617850e..66b4d3ba4 100644 --- a/sigtool/sigtool.c +++ b/sigtool/sigtool.c @@ -39,8 +39,8 @@ #include #include #include -#endif #include +#endif #include #ifdef HAVE_TERMIOS_H