[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b
aCaB
acab at clamav.net
Sun Apr 4 01:05:22 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit be4bf7f4abceca043873eb2e031295e67f6ac571
Author: aCaB <acab at clamav.net>
Date: Thu Sep 24 16:08:52 2009 +0200
win32
diff --git a/clamav-config.h.in b/clamav-config.h.in
index 2d417b7..e14726d 100644
--- a/clamav-config.h.in
+++ b/clamav-config.h.in
@@ -563,3 +563,5 @@
/* Define to "int" if <sys/socket.h> does not define. */
#undef socklen_t
+
+#include "platform.h"
diff --git a/clamd/clamd.c b/clamd/clamd.c
index 26e032f..968cd78 100644
--- a/clamd/clamd.c
+++ b/clamd/clamd.c
@@ -18,10 +18,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
@@ -70,10 +66,6 @@
#include "others.h"
#include "shared.h"
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#endif
-
short debug_mode = 0, logok = 0;
short foreground = 0;
@@ -112,12 +104,7 @@ int main(int argc, char **argv)
struct stat sb;
#endif
-#ifdef C_WINDOWS
- if(!pthread_win32_process_attach_np()) {
- mprintf("!Can't start the win32 pthreads layer\n");
- return 1;
- }
-#else
+#ifndef _WIN32
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_IGN;
sigaction(SIGHUP, &sa, NULL);
@@ -166,7 +153,7 @@ int main(int argc, char **argv)
umask(0);
/* drop privileges */
-#if (!defined(C_OS2)) && (!defined(C_WINDOWS))
+#if (!defined(C_OS2)) && (!defined(_WIN32))
if(geteuid() == 0 && (opt = optget(opts, "User"))->enabled) {
if((user = getpwnam(opt->strarg)) == NULL) {
fprintf(stderr, "ERROR: Can't get information about user %s.\n", opt->strarg);
@@ -286,7 +273,7 @@ int main(int argc, char **argv)
logg("#clamd daemon %s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")\n", get_version());
-#ifndef C_WINDOWS
+#ifndef _WIN32
if(user)
logg("#Running as user %s (UID %u, GID %u)\n", user->pw_name, user->pw_uid, user->pw_gid);
#endif
@@ -429,22 +416,13 @@ int main(int argc, char **argv)
}
if(tcpsock) {
-#ifdef C_WINDOWS
- WSADATA wsaData;
-
- if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
- logg("!Error at WSAStartup(): %d\n", WSAGetLastError());
- ret = 1;
- break;
- }
-#endif
if ((lsockets[nlsockets] = tcpserver(opts)) == -1) {
ret = 1;
break;
}
nlsockets++;
}
-
+#ifndef _WIN32
if(localsock) {
if ((lsockets[nlsockets] = localserver(opts)) == -1) {
ret = 1;
@@ -477,6 +455,7 @@ int main(int argc, char **argv)
} else
foreground = 1;
+#endif
ret = recvloop_th(lsockets, nlsockets, engine, dboptions, opts);
@@ -488,7 +467,7 @@ int main(int argc, char **argv)
closesocket(lsockets[i]);
}
-#ifndef C_OS2
+#if !defined(C_OS2) && !defined(_WIN32)
if(nlsockets && localsock) {
opt = optget(opts, "LocalSocket");
if(unlink(opt->strarg) == -1)
@@ -498,18 +477,6 @@ int main(int argc, char **argv)
}
#endif
-#ifdef C_WINDOWS
- if(tcpsock)
- WSACleanup();
-
- if(!pthread_win32_process_detach_np()) {
- logg("!Can't stop the win32 pthreads layer\n");
- logg_close();
- optfree(opts);
- return 1;
- }
-#endif
-
logg_close();
optfree(opts);
diff --git a/clamd/others.c b/clamd/others.c
index 2c70de8..ddb097b 100644
--- a/clamd/others.c
+++ b/clamd/others.c
@@ -18,10 +18,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
@@ -87,7 +83,7 @@
#include "others.h"
#include "misc.h"
-#ifdef C_WINDOWS
+#ifdef _WIN32
void virusaction(const char *filename, const char *virname, const struct optstruct *opts)
{
if(optget(opts, "VirusEvent")->enabled)
@@ -166,7 +162,7 @@ void virusaction(const char *filename, const char *virname, const struct optstru
free(buffer_file);
free(buffer_vir);
}
-#endif /* C_WINDOWS */
+#endif /* _WIN32 */
/* Function: writen
Try hard to write the specified number of bytes
@@ -421,9 +417,6 @@ void fds_remove(struct fd_data *data, int fd)
fds_unlock(data);
}
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#endif
#define BUFFSIZE 1024
/* Wait till data is available to be read on any of the fds,
* read available data on all fds, and mark them as appropriate.
diff --git a/clamd/scanner.c b/clamd/scanner.c
index 01f9ea2..e6c8041 100644
--- a/clamd/scanner.c
+++ b/clamd/scanner.c
@@ -18,10 +18,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
@@ -71,10 +67,6 @@
dev_t procdev; /* /proc device */
#endif
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#endif
-
extern int progexit;
extern time_t reloaded_time;
extern pthread_mutex_t reload_mutex;
diff --git a/clamd/server-th.c b/clamd/server-th.c
index a0a41b5..b5dbf08 100644
--- a/clamd/server-th.c
+++ b/clamd/server-th.c
@@ -19,10 +19,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
@@ -60,17 +56,7 @@
#include "libclamav/readdb.h"
#include "libclamav/cltypes.h"
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#endif
-
#define BUFFSIZE 1024
-#ifndef FALSE
-#define FALSE (0)
-#endif
-#ifndef TRUE
-#define TRUE (1)
-#endif
int progexit = 0;
pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER;
diff --git a/clamd/session.c b/clamd/session.c
index b151fbb..6918562 100644
--- a/clamd/session.c
+++ b/clamd/session.c
@@ -18,10 +18,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
diff --git a/clamd/tcpserver.c b/clamd/tcpserver.c
index 6d2bdf2..7766126 100644
--- a/clamd/tcpserver.c
+++ b/clamd/tcpserver.c
@@ -18,10 +18,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
@@ -52,9 +48,6 @@
#include "server.h"
#include "tcpserver.h"
#include "misc.h"
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#endif
int tcpserver(const struct optstruct *opts)
{
diff --git a/clamd/thrmgr.c b/clamd/thrmgr.c
index 54bedac..de82f9f 100644
--- a/clamd/thrmgr.c
+++ b/clamd/thrmgr.c
@@ -40,9 +40,6 @@
#include <malloc.h>
#endif
-#define FALSE (0)
-#define TRUE (1)
-
/* BSD and HP-UX need a bigger stacksize than the system default */
#if defined (C_BSD) || defined (C_HPUX) || defined(C_AIX)
#define C_BIGSTACK 1
diff --git a/clamdscan/client.c b/clamdscan/client.c
index cf616e1..0264764 100644
--- a/clamdscan/client.c
+++ b/clamdscan/client.c
@@ -34,7 +34,9 @@
#ifdef HAVE_SYS_LIMITS_H
#include <sys/limits.h>
#endif
+#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
+#endif
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -82,6 +84,7 @@ static int isremote(const struct optstruct *opts) {
logg("!Can't parse clamd configuration file %s\n", clamd_conf);
return 0;
}
+#ifndef _WIN32
if((opt = optget(clamdopts, "LocalSocket"))->enabled) {
memset((void *)&nixsock, 0, sizeof(nixsock));
nixsock.sun_family = AF_UNIX;
@@ -92,6 +95,7 @@ static int isremote(const struct optstruct *opts) {
optfree(clamdopts);
return 0;
}
+#endif
if(!(opt = optget(clamdopts, "TCPSocket"))->enabled) {
optfree(clamdopts);
return 0;
diff --git a/clamdscan/proto.c b/clamdscan/proto.c
index 4ea827f..a1b23bf 100644
--- a/clamdscan/proto.c
+++ b/clamdscan/proto.c
@@ -34,7 +34,9 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
+#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
+#endif
#include <arpa/inet.h>
#include "libclamav/others.h"
diff --git a/clamscan/clamscan.c b/clamscan/clamscan.c
index c0ede1d..e4e69bd 100644
--- a/clamscan/clamscan.c
+++ b/clamscan/clamscan.c
@@ -54,10 +54,6 @@
void help(void);
-#if defined(C_WINDOWS) && defined(CL_DEBUG)
-#include <crtdbg.h>
-#endif
-
struct s_info info;
short recursion = 0, printinfected = 0, bell = 0;
@@ -73,13 +69,6 @@ int main(int argc, char **argv)
struct optstruct *opts;
const struct optstruct *opt;
-#if defined(C_WINDOWS) && defined(CL_THREAD_SAFE)
- if(!pthread_win32_process_attach_np()) {
- mprintf("!Can't start the win32 pthreads layer\n");
- return 72;
- }
-#endif
-
#if !defined(C_WINDOWS) && !defined(C_BEOS)
sigemptyset(&sigset);
sigaddset(&sigset, SIGXFSZ);
@@ -156,28 +145,14 @@ int main(int argc, char **argv)
memset(&info, 0, sizeof(struct s_info));
-#ifdef C_WINDOWS
- _set_fmode(_O_BINARY);
-#ifdef CL_DEBUG
- {
- _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
- }
-#endif
- gettimeofday(&t1, NULL);
-#else
gettimeofday(&t1, &tz);
-#endif
ret = scanmanager(opts);
if(!optget(opts, "no-summary")->enabled) {
-#ifdef C_WINDOWS
- gettimeofday(&t2, NULL);
-#else
gettimeofday(&t2, &tz);
-#endif
- ds = t2.tv_sec - t1.tv_sec;
+
+ ds = t2.tv_sec - t1.tv_sec;
dms = t2.tv_usec - t1.tv_usec;
ds -= (dms < 0) ? (1):(0);
dms += (dms < 0) ? (1000000):(0);
@@ -202,13 +177,6 @@ int main(int argc, char **argv)
optfree(opts);
-#if defined(C_WINDOWS) && defined(CL_THREAD_SAFE)
- if(!pthread_win32_process_detach_np()) {
- logg("!Can't stop the win32 pthreads layer\n");
- return 72;
- }
-#endif
-
return ret;
}
diff --git a/clamscan/manager.c b/clamscan/manager.c
index 38aba5a..a86c1ce 100644
--- a/clamscan/manager.c
+++ b/clamscan/manager.c
@@ -129,7 +129,7 @@ static int scanfile(const char *filename, struct cl_engine *engine, const struct
return 0;
}
info.rblocks += fsize / CL_COUNT_PRECISION;
-#ifndef C_WINDOWS
+#ifndef _WIN32
if(geteuid())
if(checkaccess(filename, NULL, R_OK) != 1) {
if(!printinfected)
@@ -141,7 +141,7 @@ static int scanfile(const char *filename, struct cl_engine *engine, const struct
logg("*Scanning %s\n", filename);
if((fd = open(filename, O_RDONLY|O_BINARY)) == -1) {
- logg("^Can't open file %s\n", filename);
+ logg("^Can't open file %s: %s\n", filename, strerror(errno));
return 54;
}
@@ -214,9 +214,7 @@ static int scandirs(const char *dirname, struct cl_engine *engine, const struct
if((dd = opendir(dirname)) != NULL) {
while((dent = readdir(dd))) {
-#if !defined(C_INTERIX) && !defined(C_WINDOWS)
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
/* build the full name */
diff --git a/clamscan/others.c b/clamscan/others.c
index 1354ab4..b662c81 100644
--- a/clamscan/others.c
+++ b/clamscan/others.c
@@ -73,7 +73,7 @@ int fileinfo(const char *filename, short i)
}
}
-#ifdef C_WINDOWS
+#ifdef _WIN32
/* FIXME: Handle users correctly */
int checkaccess(const char *path, const char *username, int mode)
{
diff --git a/configure b/configure
index d1da246..5abbe90 100755
--- a/configure
+++ b/configure
@@ -2563,6 +2563,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
ac_aux_dir=
for ac_dir in config "$srcdir"/config; do
for ac_t in install-sh install.sh shtool; do
@@ -5129,13 +5130,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:5132: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:5133: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:5135: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:5136: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:5138: output\"" >&5)
+ (eval echo "\"\$as_me:5139: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -6330,7 +6331,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6333 "configure"' > conftest.$ac_ext
+ echo '#line 6334 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7859,11 +7860,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7862: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7863: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7866: \$? = $ac_status" >&5
+ echo "$as_me:7867: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8198,11 +8199,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8201: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8202: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8205: \$? = $ac_status" >&5
+ echo "$as_me:8206: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8303,11 +8304,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8306: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8307: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8310: \$? = $ac_status" >&5
+ echo "$as_me:8311: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8358,11 +8359,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8361: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8362: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8365: \$? = $ac_status" >&5
+ echo "$as_me:8366: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10741,7 +10742,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10744 "configure"
+#line 10745 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10837,7 +10838,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10840 "configure"
+#line 10841 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11509,7 +11510,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11512 "configure"
+#line 11513 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/configure.in b/configure.in
index 6e25959..9b3c79a 100644
--- a/configure.in
+++ b/configure.in
@@ -22,6 +22,7 @@ dnl For a release change [devel] to the real version [0.xy]
dnl also change VERSION below
AC_INIT([ClamAV], [devel], [http://bugs.clamav.net/], [clamav], [http://www.clamav.net/])
+AH_BOTTOM([#include "platform.h"])
dnl put configure auxiliary into config
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADER([clamav-config.h])
diff --git a/freshclam/execute.c b/freshclam/execute.c
index 9f99ab0..e1398c4 100644
--- a/freshclam/execute.c
+++ b/freshclam/execute.c
@@ -28,9 +28,6 @@
#endif
#include <string.h>
#include <errno.h>
-#ifdef C_WINDOWS
-#include <process.h>
-#endif
#include "shared/output.h"
#include "shared/optparser.h"
@@ -58,7 +55,7 @@ void execute( const char *type, const char *text, const struct optstruct *opts )
return;
}
-#ifdef C_WINDOWS
+#ifdef _WIN32
if(active_children < MAX_CHILDREN) {
if(spawnlp(P_DETACH, text, text, NULL) == -1) {
logg("^%s: couldn't execute \"%s\".\n", type, text);
diff --git a/freshclam/freshclam.c b/freshclam/freshclam.c
index 25cbc04..86e0bae 100644
--- a/freshclam/freshclam.c
+++ b/freshclam/freshclam.c
@@ -15,9 +15,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
#if HAVE_CONFIG_H
#include "clamav-config.h"
@@ -131,9 +128,11 @@ static void help(void)
mprintf("\n");
mprintf(" --config-file=FILE read configuration from FILE.\n");
mprintf(" --log=FILE -l FILE log into FILE\n");
+#ifndef _WIN32
mprintf(" --daemon -d run in daemon mode\n");
mprintf(" --pid=FILE -p FILE save daemon's pid in FILE\n");
mprintf(" --user=USER -u USER run as USER\n");
+#endif
mprintf(" --no-dns force old non-DNS verification method\n");
mprintf(" --checks=#n -c #n number of checks per day, 1 <= n <= 50\n");
mprintf(" --datadir=DIRECTORY download new databases into DIRECTORY\n");
@@ -239,14 +238,6 @@ int main(int argc, char **argv)
return 0;
}
-#ifdef C_WINDOWS
- if(!pthread_win32_process_attach_np()) {
- mprintf("!Can't start the win32 pthreads layer\n");
- optfree(opts);
- return 63;
- }
-#endif
-
if(optget(opts, "HTTPProxyPassword")->enabled) {
if(stat(cfgfile, &statbuf) == -1) {
logg("^Can't stat %s (critical error)\n", cfgfile);
@@ -254,7 +245,7 @@ int main(int argc, char **argv)
return 56;
}
-#ifndef C_WINDOWS
+#ifndef _WIN32
if(statbuf.st_mode & (S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)) {
logg("^Insecure permissions (for HTTPProxyPassword): %s must have no more than 0700 permissions.\n", cfgfile);
optfree(opts);
@@ -263,7 +254,7 @@ int main(int argc, char **argv)
#endif
}
-#if !defined(C_OS2) && !defined(C_WINDOWS)
+#if !defined(C_OS2) && !defined(_WIN32)
/* freshclam shouldn't work with root privileges */
dbowner = optget(opts, "DatabaseOwner")->strarg;
@@ -378,18 +369,6 @@ int main(int argc, char **argv)
return 0;
}
-#ifdef C_WINDOWS
- {
- WSADATA wsaData;
-
- if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
- logg("!Error at WSAStartup(): %d\n", WSAGetLastError());
- optfree(opts);
- return 1;
- }
- }
-#endif
-
if(optget(opts, "daemon")->enabled) {
int bigsleep, checks;
#ifndef C_WINDOWS
@@ -417,7 +396,7 @@ int main(int argc, char **argv)
bigsleep = 24 * 3600 / checks;
-#if !defined(C_OS2) && !defined(C_WINDOWS)
+#if !defined(C_OS2) && !defined(_WIN32)
if(!optget(opts, "Foreground")->enabled) {
if(daemonize() == -1) {
logg("!daemonize() failed\n");
@@ -472,7 +451,7 @@ int main(int argc, char **argv)
sigaction(SIGUSR1, &sigact, &oldact);
#endif
-#ifdef C_WINDOWS
+#ifdef _WIN32
sleep(bigsleep);
#else
time(&wakeup);
@@ -525,14 +504,5 @@ int main(int argc, char **argv)
optfree(opts);
-#ifdef C_WINDOWS
- WSACleanup();
-
- if(!pthread_win32_process_detach_np()) {
- mprintf("!Can't stop the win32 pthreads layer\n");
- return 63;
- }
-#endif
-
return(ret);
}
diff --git a/freshclam/manager.c b/freshclam/manager.c
index f690c15..05fcbc2 100644
--- a/freshclam/manager.c
+++ b/freshclam/manager.c
@@ -22,9 +22,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h> /* only needed in CL_EXPERIMENTAL */
-#endif
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
@@ -59,9 +56,7 @@
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
-#ifndef C_WINDOWS
#include <dirent.h>
-#endif
#include <errno.h>
#include <zlib.h>
@@ -85,14 +80,6 @@
#include "libclamav/str.h"
#include "libclamav/cvd.h"
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#endif
-
#define CHDIR_ERR(x) \
if(chdir(x) == -1) \
logg("!Can't chdir to %s\n", x);
@@ -1419,9 +1406,7 @@ static int buildcld(const char *tmpdir, const char *dbname, const char *newfile,
}
while((dent = readdir(dir))) {
-#if !defined(C_INTERIX) && !defined(C_WINDOWS)
if(dent->d_ino)
-#endif
{
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") || !strcmp(dent->d_name, "COPYING") || !strcmp(dent->d_name, "daily.cfg"))
continue;
@@ -1683,7 +1668,7 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig
return 55; /* FIXME */
}
-#ifdef C_WINDOWS
+#ifdef _WIN32
if(!access(newdb, R_OK) && unlink(newdb)) {
logg("!Can't unlink %s. Please fix the problem manually and try again.\n", newdb);
unlink(newfile);
diff --git a/freshclam/mirman.c b/freshclam/mirman.c
index e9a9e0a..034bd0f 100644
--- a/freshclam/mirman.c
+++ b/freshclam/mirman.c
@@ -16,10 +16,6 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
diff --git a/freshclam/nonblock.c b/freshclam/nonblock.c
index c36ad53..cf8e9d6 100644
--- a/freshclam/nonblock.c
+++ b/freshclam/nonblock.c
@@ -15,9 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef _MSC_VER
-#include <winsock.h>
-#endif
#if HAVE_CONFIG_H
#include "clamav-config.h"
diff --git a/freshclam/notify.c b/freshclam/notify.c
index 5948fbd..211b977 100644
--- a/freshclam/notify.c
+++ b/freshclam/notify.c
@@ -15,11 +15,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <windows.h>
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
@@ -45,10 +40,6 @@
#include "shared/output.h"
#include "notify.h"
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#endif
-
int notify(const char *cfgfile)
{
char buff[20];
diff --git a/libclamav/blob.c b/libclamav/blob.c
index f47a2ac..891efa5 100644
--- a/libclamav/blob.c
+++ b/libclamav/blob.c
@@ -24,11 +24,6 @@ static char const rcsid[] = "$Id: blob.c,v 1.64 2007/02/12 22:25:14 njh Exp $";
#include "clamav-config.h"
#endif
-#ifdef C_WINDOWS
-#include "stdafx.h"
-#include <io.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -59,10 +54,6 @@ static char const rcsid[] = "$Id: blob.c,v 1.64 2007/02/12 22:25:14 njh Exp $";
#include <assert.h>
-#if defined(C_MINGW) || defined(C_WINDOWS)
-#include <windows.h>
-#endif
-
/* Scehduled for rewite in 0.94 (bb#804). Disabling for now */
/* #define MAX_SCAN_SIZE 20*1024 /\* */
/* * The performance benefit of scanning */
@@ -689,7 +680,7 @@ sanitiseName(char *name)
* I don't know if spaces are legal in OS/2.
*/
if(strchr("%/*?<>|\\\"+=,;:\t ~", *name))
-#elif defined(C_WINDOWS)
+#elif defined(_WIN32)
if(strchr("%/*?<>|\\\"+=,;:\t~", *name))
#else
if(*name == '/')
diff --git a/libclamav/chmunpack.c b/libclamav/chmunpack.c
index 97647af..7c3896c 100644
--- a/libclamav/chmunpack.c
+++ b/libclamav/chmunpack.c
@@ -769,7 +769,7 @@ static int chm_decompress_stream(int fd, chm_metadata_t *metadata, const char *d
lzx_decompress(stream, length);
lzx_free(stream);
-#ifndef C_WINDOWS
+#ifndef _WIN32
/* Delete the file */
if(cli_unlink(filename))
retval = -1;
diff --git a/libclamav/mbox.c b/libclamav/mbox.c
index 5e9ecac..46a352f 100644
--- a/libclamav/mbox.c
+++ b/libclamav/mbox.c
@@ -20,10 +20,6 @@
static char const rcsid[] = "$Id: mbox.c,v 1.381 2007/02/15 12:26:44 njh Exp $";
-#ifdef _MSC_VER
-#include <winsock.h> /* only needed in CL_EXPERIMENTAL */
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
@@ -54,9 +50,7 @@ static char const rcsid[] = "$Id: mbox.c,v 1.381 2007/02/15 12:26:44 njh Exp $";
#include <sys/param.h>
#endif
#include "clamav.h"
-#ifndef C_WINDOWS
#include <dirent.h>
-#endif
#include <limits.h>
#include <signal.h>
@@ -141,7 +135,7 @@ typedef enum {
#include "phishcheck.h"
-#ifndef C_WINDOWS
+#ifndef _WIN32
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -151,10 +145,6 @@ typedef enum {
#endif
#endif
-#ifndef C_WINDOWS
-#define closesocket(s) close(s)
-#define SOCKET int
-#endif
#include <fcntl.h>
#ifndef C_WINDOWS
@@ -169,16 +159,6 @@ typedef unsigned short in_port_t;
typedef unsigned int in_addr_t;
#endif
-#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
-
/*
* Use CL_SCAN_PARTIAL_MESSAGE to handle messages covered by section 7.3.2 of RFC1341.
* This is experimental code so it is up to YOU to (1) ensure it's secure
@@ -3826,10 +3806,9 @@ rfc1341(message *m, const char *dir)
int nblanks;
struct stat statb;
const char *dentry_idpart;
-#ifndef C_WINDOWS
+
if(dent->d_ino == 0)
continue;
-#endif
if(!strcmp(".",dent->d_name) ||
!strcmp("..", dent->d_name))
diff --git a/libclamav/mbox.h b/libclamav/mbox.h
index 3b82296..3269695 100644
--- a/libclamav/mbox.h
+++ b/libclamav/mbox.h
@@ -18,6 +18,9 @@
* MA 02110-1301, USA.
*/
+#ifndef __MBOX_H
+#define __MBOX_H
+
/* See RFC1521 */
typedef enum {
NOMIME, APPLICATION, AUDIO, IMAGE, MESSAGE, MULTIPART, TEXT, VIDEO, MEXTENSION
@@ -48,3 +51,5 @@ typedef enum {
size_t strstrip(char *s); /* remove trailing white space */
int cli_mbox(const char *dir, int desc, cli_ctx *ctx);
+
+#endif /* __MBOX_H */
diff --git a/libclamav/others.c b/libclamav/others.c
index 55663df..c53b376 100644
--- a/libclamav/others.c
+++ b/libclamav/others.c
@@ -54,9 +54,6 @@
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
-#if defined(_MSC_VER) && defined(_DEBUG)
-#include <crtdbg.h>
-#endif
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
#include <limits.h>
@@ -784,9 +781,7 @@ int cli_rmdirs(const char *dirname)
#else
while((dent = readdir(dd))) {
#endif
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
path = cli_malloc(strlen(dirname) + strlen(dent->d_name) + 2);
@@ -901,8 +896,6 @@ int cli_dumpscan(int fd, off_t offset, size_t size, cli_ctx *ctx)
#define BITS_PER_CHAR (8)
#define BITSET_DEFAULT_SIZE (1024)
-#define FALSE (0)
-#define TRUE (1)
static unsigned long nearest_power(unsigned long num)
{
diff --git a/libclamav/others.h b/libclamav/others.h
index c4712b2..7425edd 100644
--- a/libclamav/others.h
+++ b/libclamav/others.h
@@ -316,21 +316,6 @@ static inline void cli_writeint32(char *offset, uint32_t value)
#endif
#define CLI_SAR(n,s) n = CLI_SRS(n,s)
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef MIN
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
typedef struct bitset_tag
{
unsigned char *bitset;
diff --git a/libclamav/others_common.c b/libclamav/others_common.c
index 151e26f..5d9c965 100644
--- a/libclamav/others_common.c
+++ b/libclamav/others_common.c
@@ -54,9 +54,6 @@
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
-#if defined(_MSC_VER) && defined(_DEBUG)
-#include <crtdbg.h>
-#endif
#include "clamav.h"
#include "others.h"
@@ -138,11 +135,7 @@ void *cli_malloc(size_t size)
return NULL;
}
-#if defined(_MSC_VER) && defined(_DEBUG)
- alloc = _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__);
-#else
alloc = malloc(size);
-#endif
if(!alloc) {
cli_errmsg("cli_malloc(): Can't allocate memory (%lu bytes).\n", (unsigned long int) size);
@@ -161,11 +154,7 @@ void *cli_calloc(size_t nmemb, size_t size)
return NULL;
}
-#if defined(_MSC_VER) && defined(_DEBUG)
- alloc = _calloc_dbg(nmemb, size, _NORMAL_BLOCK, __FILE__, __LINE__);
-#else
alloc = calloc(nmemb, size);
-#endif
if(!alloc) {
cli_errmsg("cli_calloc(): Can't allocate memory (%lu bytes).\n", (unsigned long int) (nmemb * size));
@@ -224,11 +213,7 @@ char *cli_strdup(const char *s)
return NULL;
}
-#if defined(_MSC_VER) && defined(_DEBUG)
- alloc = _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__);
-#else
alloc = strdup(s);
-#endif
if(!alloc) {
cli_errmsg("cli_strdup(): Can't allocate memory (%u bytes).\n", (unsigned int) strlen(s));
diff --git a/libclamav/phishcheck.c b/libclamav/phishcheck.c
index 987716e..be21e80 100644
--- a/libclamav/phishcheck.c
+++ b/libclamav/phishcheck.c
@@ -322,9 +322,6 @@ static int build_regex(regex_t* preg,const char* regex,int nosub)
rc = cli_regcomp(preg,regex,REG_EXTENDED|REG_ICASE|(nosub ? REG_NOSUB :0));
if(rc) {
-#ifdef C_WINDOWS
- cli_errmsg("Phishcheck: Error in compiling regex, disabling phishing checks\n");
-#else
size_t buflen = cli_regerror(rc,preg,NULL,0);
char *errbuf = cli_malloc(buflen);
@@ -334,7 +331,6 @@ static int build_regex(regex_t* preg,const char* regex,int nosub)
free(errbuf);
} else
cli_errmsg("Phishcheck: Error in compiling regex, disabling phishing checks. Additionally an Out-of-memory error was encountered while generating a detailed error message\n");
-#endif
return 1;
}
return CL_SUCCESS;
diff --git a/libclamav/readdb.c b/libclamav/readdb.c
index c333904..8fa04e0 100644
--- a/libclamav/readdb.c
+++ b/libclamav/readdb.c
@@ -29,9 +29,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifndef C_WINDOWS
#include <dirent.h>
-#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_PARAM_H
@@ -1549,13 +1547,7 @@ int cli_load(const char *filename, struct cl_engine *engine, unsigned int *signo
return CL_EOPEN;
}
-/*
-#ifdef C_WINDOWS
- if((dbname = strrchr(filename, '\\')))
-#else
-*/
if((dbname = strrchr(filename, '/')))
-/*#endif */
dbname++;
else
dbname = filename;
@@ -1723,9 +1715,7 @@ static int cli_loaddbdir(const char *dirname, struct cl_engine *engine, unsigned
#else
while((dent = readdir(dd))) {
#endif
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && strcmp(dent->d_name, "daily.cvd") && strcmp(dent->d_name, "daily.cld") && strcmp(dent->d_name, "daily.ign") && strcmp(dent->d_name, "daily.cfg") && strcmp(dent->d_name, "local.ign") && CLI_DBEXT(dent->d_name)) {
@@ -1842,9 +1832,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
#else
while((dent = readdir(dd))) {
#endif
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && CLI_DBEXT(dent->d_name)) {
dbstat->entries++;
@@ -1925,9 +1913,7 @@ int cl_statchkdir(const struct cl_stat *dbstat)
#else
while((dent = readdir(dd))) {
#endif
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && CLI_DBEXT(dent->d_name)) {
fname = cli_malloc(strlen(dbstat->dir) + strlen(dent->d_name) + 32);
diff --git a/libclamav/scanners.c b/libclamav/scanners.c
index 2eab5f6..9a29ffd 100644
--- a/libclamav/scanners.c
+++ b/libclamav/scanners.c
@@ -130,9 +130,7 @@ static int cli_scandir(const char *dirname, cli_ctx *ctx)
#else
while((dent = readdir(dd))) {
#endif
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
/* build the full name */
@@ -882,9 +880,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx, struct uniq *U)
#else
while((dent = readdir(dd))) {
#endif
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
/* build the full name */
diff --git a/libclamav/special.c b/libclamav/special.c
index 7241f2a..e50b9cd 100644
--- a/libclamav/special.c
+++ b/libclamav/special.c
@@ -18,11 +18,9 @@
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <windows.h>
-#endif
-
+#if HAVE_CONFIG_H
#include "clamav-config.h"
+#endif
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/libclamav/text.h b/libclamav/text.h
index 8ca38fb..b7590cd 100644
--- a/libclamav/text.h
+++ b/libclamav/text.h
@@ -41,6 +41,9 @@
*
*/
+#ifndef __TEXT_H
+#define __TEXT_H
+
/* The contents could change, ONLY access in text.c */
typedef struct text {
line_t *t_line; /* NULL if the line is empty */
@@ -54,3 +57,5 @@ text *textAddMessage(text *aText, message *aMessage);
text *textMove(text *t_head, text *t);
blob *textToBlob(text *t, blob *b, int destroy);
fileblob *textToFileblob(text *t, fileblob *fb, int destroy);
+
+#endif /* __TEXT_H */
diff --git a/libclamav/uuencode.c b/libclamav/uuencode.c
index 3f3ad0f..71fa0ba 100644
--- a/libclamav/uuencode.c
+++ b/libclamav/uuencode.c
@@ -39,10 +39,6 @@ static char const rcsid[] = "$Id: uuencode.c,v 1.8 2006/12/11 11:55:11 njh Exp $
#include "others.h"
#include "str.h"
-#ifdef C_WINDOWS
-#include <io.h>
-#endif
-
#include "mbox.h"
#include "uuencode.h"
diff --git a/libclamunrar/unrar.c b/libclamunrar/unrar.c
index 21a01d5..06970c3 100644
--- a/libclamunrar/unrar.c
+++ b/libclamunrar/unrar.c
@@ -15,6 +15,10 @@
*
*/
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/libclamunrar/unrar.h b/libclamunrar/unrar.h
index e4e4403..a2cc746 100644
--- a/libclamunrar/unrar.h
+++ b/libclamunrar/unrar.h
@@ -35,12 +35,6 @@ struct unpack_data_tag;
#include "libclamunrar/unrarcmd.h"
#include "libclamunrar/unrarfilter.h"
-#define FALSE (0)
-#define TRUE (1)
-#ifndef MIN
-#define MIN(a,b) ((a < b) ? a : b)
-#endif
-
#define SIZEOF_MARKHEAD 7
#define SIZEOF_NEWMHD 13
#define SIZEOF_NEWLHD 32
diff --git a/libclamunrar/unrarhlp.c b/libclamunrar/unrarhlp.c
index 5fee172..9ad7ea9 100644
--- a/libclamunrar/unrarhlp.c
+++ b/libclamunrar/unrarhlp.c
@@ -27,15 +27,10 @@ void *rar_malloc(size_t size)
return NULL;
}
-#if defined(_MSC_VER) && defined(_DEBUG)
- alloc = _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__);
-#else
alloc = malloc(size);
-#endif
if(!alloc) {
fprintf(stderr, "UNRAR: rar_malloc(): Can't allocate memory (%lu bytes).\n", size);
- perror("malloc_problem");
return NULL;
} else return alloc;
}
@@ -54,7 +49,6 @@ void *rar_realloc2(void *ptr, size_t size)
if(!alloc) {
fprintf(stderr, "UNRAR: rar_realloc2(): Can't allocate memory (%lu bytes).\n", size);
- perror("rar_realloc2");
if(ptr)
free(ptr);
return NULL;
diff --git a/libclamunrar/unrarvm.h b/libclamunrar/unrarvm.h
index a150a5d..e8c1dff 100644
--- a/libclamunrar/unrarvm.h
+++ b/libclamunrar/unrarvm.h
@@ -21,12 +21,6 @@
#include "libclamunrar/unrarcmd.h"
-#define FALSE (0)
-#define TRUE (1)
-#ifndef MIN
-#define MIN(a,b) ((a < b) ? a : b)
-#endif
-
#define RARVM_MEMSIZE 0x40000
#define RARVM_MEMMASK (RARVM_MEMSIZE-1)
diff --git a/libclamunrar_iface/unrar_iface.c b/libclamunrar_iface/unrar_iface.c
index 36d8412..bedc1a9 100644
--- a/libclamunrar_iface/unrar_iface.c
+++ b/libclamunrar_iface/unrar_iface.c
@@ -535,23 +535,3 @@ void unrar_close(unrar_state_t *state)
free(state->unpack_data);
free(state->comment_dir);
}
-
-#ifdef C_WINDOWS
-/*
- * A copy is needed here to avoid a cyclic dependancy libclamunrar_iface<->libclamav
- * e.g. see the comment in bug 775 about dropping the old internal snprintf
- * which didn't have this problem and bug 785
- */
-#include <stdarg.h>
-static int
-snprintf(char *str, size_t size, const char *format, ...)
-{
- int ret;
-
- va_list args;
- va_start(args, format);
- ret = _vsnprintf_s(str, size, _TRUNCATE, format, args);
- va_end(args);
- return ret;
-}
-#endif
diff --git a/platform.h b/platform.h
new file mode 100644
index 0000000..6445507
--- /dev/null
+++ b/platform.h
@@ -0,0 +1,21 @@
+#ifndef _WIN32
+#define closesocket(s) close(s)
+#endif
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+#ifndef TRUE
+#define TRUE (1)
+#endif
+
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
diff --git a/shared/getopt.c b/shared/getopt.c
index df5f0f5..b02d7cf 100644
--- a/shared/getopt.c
+++ b/shared/getopt.c
@@ -23,6 +23,10 @@
* DEALINGS IN THE SOFTWARE.
*/
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/shared/misc.c b/shared/misc.c
index 49d1de1..74690af 100644
--- a/shared/misc.c
+++ b/shared/misc.c
@@ -32,9 +32,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
-#ifndef C_WINDOWS
#include <dirent.h>
-#endif
#include <fcntl.h>
#include <ctype.h>
#include <errno.h>
@@ -225,7 +223,7 @@ int filecopy(const char *src, const char *dest)
int daemonize(void)
{
-#if defined(C_OS2) || defined(C_WINDOWS)
+#if defined(C_OS2) || defined(_WIN32)
fputs("Background mode is not supported on your operating system\n", stderr);
return -1;
#else
diff --git a/shared/network.c b/shared/network.c
index 837f40d..bd2b6e7 100644
--- a/shared/network.c
+++ b/shared/network.c
@@ -20,11 +20,6 @@
*
*/
-#ifdef _MSC_VER
-#include <windows.h>
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
diff --git a/shared/output.c b/shared/output.c
index 5e8b62e..edf29c6 100644
--- a/shared/output.c
+++ b/shared/output.c
@@ -17,11 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-#ifdef _MSC_VER
-#include <windows.h>
-#include <winsock.h>
-#endif
-
#if HAVE_CONFIG_H
#include "clamav-config.h"
diff --git a/sigtool/sigtool.c b/sigtool/sigtool.c
index d2dd4e0..70e8af5 100644
--- a/sigtool/sigtool.c
+++ b/sigtool/sigtool.c
@@ -987,9 +987,7 @@ static int listdir(const char *dirname)
}
while((dent = readdir(dd))) {
-#ifndef C_INTERIX
if(dent->d_ino)
-#endif
{
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") &&
(cli_strbcasestr(dent->d_name, ".db") ||
@@ -1469,9 +1467,7 @@ static int dircopy(const char *src, const char *dest)
}
while((dent = readdir(dd))) {
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino)
-#endif
{
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
continue;
@@ -1617,9 +1613,7 @@ static int diffdirs(const char *old, const char *new, const char *patch)
}
while((dent = readdir(dd))) {
-#ifndef C_INTERIX
if(dent->d_ino)
-#endif
{
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
continue;
@@ -1645,9 +1639,7 @@ static int diffdirs(const char *old, const char *new, const char *patch)
}
while((dent = readdir(dd))) {
-#ifndef C_INTERIX
if(dent->d_ino)
-#endif
{
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
continue;
diff --git a/sigtool/vba.c b/sigtool/vba.c
index 8984723..5532b6a 100644
--- a/sigtool/vba.c
+++ b/sigtool/vba.c
@@ -17,6 +17,10 @@
* MA 02110-1301, USA.
*/
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list