| ... | ... |
@@ -18,10 +18,6 @@ |
| 18 | 18 |
* MA 02110-1301, USA. |
| 19 | 19 |
*/ |
| 20 | 20 |
|
| 21 |
-#ifdef _MSC_VER |
|
| 22 |
-#include <winsock.h> |
|
| 23 |
-#endif |
|
| 24 |
- |
|
| 25 | 21 |
#if HAVE_CONFIG_H |
| 26 | 22 |
#include "clamav-config.h" |
| 27 | 23 |
#endif |
| ... | ... |
@@ -70,10 +66,6 @@ |
| 70 | 70 |
#include "others.h" |
| 71 | 71 |
#include "shared.h" |
| 72 | 72 |
|
| 73 |
-#ifndef C_WINDOWS |
|
| 74 |
-#define closesocket(s) close(s) |
|
| 75 |
-#endif |
|
| 76 |
- |
|
| 77 | 73 |
short debug_mode = 0, logok = 0; |
| 78 | 74 |
short foreground = 0; |
| 79 | 75 |
|
| ... | ... |
@@ -112,12 +104,7 @@ int main(int argc, char **argv) |
| 112 | 112 |
struct stat sb; |
| 113 | 113 |
#endif |
| 114 | 114 |
|
| 115 |
-#ifdef C_WINDOWS |
|
| 116 |
- if(!pthread_win32_process_attach_np()) {
|
|
| 117 |
- mprintf("!Can't start the win32 pthreads layer\n");
|
|
| 118 |
- return 1; |
|
| 119 |
- } |
|
| 120 |
-#else |
|
| 115 |
+#ifndef _WIN32 |
|
| 121 | 116 |
memset(&sa, 0, sizeof(sa)); |
| 122 | 117 |
sa.sa_handler = SIG_IGN; |
| 123 | 118 |
sigaction(SIGHUP, &sa, NULL); |
| ... | ... |
@@ -166,7 +153,7 @@ int main(int argc, char **argv) |
| 166 | 166 |
umask(0); |
| 167 | 167 |
|
| 168 | 168 |
/* drop privileges */ |
| 169 |
-#if (!defined(C_OS2)) && (!defined(C_WINDOWS)) |
|
| 169 |
+#if (!defined(C_OS2)) && (!defined(_WIN32)) |
|
| 170 | 170 |
if(geteuid() == 0 && (opt = optget(opts, "User"))->enabled) {
|
| 171 | 171 |
if((user = getpwnam(opt->strarg)) == NULL) {
|
| 172 | 172 |
fprintf(stderr, "ERROR: Can't get information about user %s.\n", opt->strarg); |
| ... | ... |
@@ -286,7 +273,7 @@ int main(int argc, char **argv) |
| 286 | 286 |
|
| 287 | 287 |
logg("#clamd daemon %s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")\n", get_version());
|
| 288 | 288 |
|
| 289 |
-#ifndef C_WINDOWS |
|
| 289 |
+#ifndef _WIN32 |
|
| 290 | 290 |
if(user) |
| 291 | 291 |
logg("#Running as user %s (UID %u, GID %u)\n", user->pw_name, user->pw_uid, user->pw_gid);
|
| 292 | 292 |
#endif |
| ... | ... |
@@ -429,22 +416,13 @@ int main(int argc, char **argv) |
| 429 | 429 |
} |
| 430 | 430 |
|
| 431 | 431 |
if(tcpsock) {
|
| 432 |
-#ifdef C_WINDOWS |
|
| 433 |
- WSADATA wsaData; |
|
| 434 |
- |
|
| 435 |
- if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
|
|
| 436 |
- logg("!Error at WSAStartup(): %d\n", WSAGetLastError());
|
|
| 437 |
- ret = 1; |
|
| 438 |
- break; |
|
| 439 |
- } |
|
| 440 |
-#endif |
|
| 441 | 432 |
if ((lsockets[nlsockets] = tcpserver(opts)) == -1) {
|
| 442 | 433 |
ret = 1; |
| 443 | 434 |
break; |
| 444 | 435 |
} |
| 445 | 436 |
nlsockets++; |
| 446 | 437 |
} |
| 447 |
- |
|
| 438 |
+#ifndef _WIN32 |
|
| 448 | 439 |
if(localsock) {
|
| 449 | 440 |
if ((lsockets[nlsockets] = localserver(opts)) == -1) {
|
| 450 | 441 |
ret = 1; |
| ... | ... |
@@ -477,6 +455,7 @@ int main(int argc, char **argv) |
| 477 | 477 |
|
| 478 | 478 |
} else |
| 479 | 479 |
foreground = 1; |
| 480 |
+#endif |
|
| 480 | 481 |
|
| 481 | 482 |
ret = recvloop_th(lsockets, nlsockets, engine, dboptions, opts); |
| 482 | 483 |
|
| ... | ... |
@@ -488,7 +467,7 @@ int main(int argc, char **argv) |
| 488 | 488 |
closesocket(lsockets[i]); |
| 489 | 489 |
} |
| 490 | 490 |
|
| 491 |
-#ifndef C_OS2 |
|
| 491 |
+#if !defined(C_OS2) && !defined(_WIN32) |
|
| 492 | 492 |
if(nlsockets && localsock) {
|
| 493 | 493 |
opt = optget(opts, "LocalSocket"); |
| 494 | 494 |
if(unlink(opt->strarg) == -1) |
| ... | ... |
@@ -498,18 +477,6 @@ int main(int argc, char **argv) |
| 498 | 498 |
} |
| 499 | 499 |
#endif |
| 500 | 500 |
|
| 501 |
-#ifdef C_WINDOWS |
|
| 502 |
- if(tcpsock) |
|
| 503 |
- WSACleanup(); |
|
| 504 |
- |
|
| 505 |
- if(!pthread_win32_process_detach_np()) {
|
|
| 506 |
- logg("!Can't stop the win32 pthreads layer\n");
|
|
| 507 |
- logg_close(); |
|
| 508 |
- optfree(opts); |
|
| 509 |
- return 1; |
|
| 510 |
- } |
|
| 511 |
-#endif |
|
| 512 |
- |
|
| 513 | 501 |
logg_close(); |
| 514 | 502 |
optfree(opts); |
| 515 | 503 |
|
| ... | ... |
@@ -18,10 +18,6 @@ |
| 18 | 18 |
* MA 02110-1301, USA. |
| 19 | 19 |
*/ |
| 20 | 20 |
|
| 21 |
-#ifdef _MSC_VER |
|
| 22 |
-#include <winsock.h> |
|
| 23 |
-#endif |
|
| 24 |
- |
|
| 25 | 21 |
#if HAVE_CONFIG_H |
| 26 | 22 |
#include "clamav-config.h" |
| 27 | 23 |
#endif |
| ... | ... |
@@ -87,7 +83,7 @@ |
| 87 | 87 |
#include "others.h" |
| 88 | 88 |
#include "misc.h" |
| 89 | 89 |
|
| 90 |
-#ifdef C_WINDOWS |
|
| 90 |
+#ifdef _WIN32 |
|
| 91 | 91 |
void virusaction(const char *filename, const char *virname, const struct optstruct *opts) |
| 92 | 92 |
{
|
| 93 | 93 |
if(optget(opts, "VirusEvent")->enabled) |
| ... | ... |
@@ -166,7 +162,7 @@ void virusaction(const char *filename, const char *virname, const struct optstru |
| 166 | 166 |
free(buffer_file); |
| 167 | 167 |
free(buffer_vir); |
| 168 | 168 |
} |
| 169 |
-#endif /* C_WINDOWS */ |
|
| 169 |
+#endif /* _WIN32 */ |
|
| 170 | 170 |
|
| 171 | 171 |
/* Function: writen |
| 172 | 172 |
Try hard to write the specified number of bytes |
| ... | ... |
@@ -421,9 +417,6 @@ void fds_remove(struct fd_data *data, int fd) |
| 421 | 421 |
fds_unlock(data); |
| 422 | 422 |
} |
| 423 | 423 |
|
| 424 |
-#ifndef C_WINDOWS |
|
| 425 |
-#define closesocket(s) close(s) |
|
| 426 |
-#endif |
|
| 427 | 424 |
#define BUFFSIZE 1024 |
| 428 | 425 |
/* Wait till data is available to be read on any of the fds, |
| 429 | 426 |
* read available data on all fds, and mark them as appropriate. |
| ... | ... |
@@ -18,10 +18,6 @@ |
| 18 | 18 |
* MA 02110-1301, USA. |
| 19 | 19 |
*/ |
| 20 | 20 |
|
| 21 |
-#ifdef _MSC_VER |
|
| 22 |
-#include <winsock.h> |
|
| 23 |
-#endif |
|
| 24 |
- |
|
| 25 | 21 |
#if HAVE_CONFIG_H |
| 26 | 22 |
#include "clamav-config.h" |
| 27 | 23 |
#endif |
| ... | ... |
@@ -71,10 +67,6 @@ |
| 71 | 71 |
dev_t procdev; /* /proc device */ |
| 72 | 72 |
#endif |
| 73 | 73 |
|
| 74 |
-#ifndef C_WINDOWS |
|
| 75 |
-#define closesocket(s) close(s) |
|
| 76 |
-#endif |
|
| 77 |
- |
|
| 78 | 74 |
extern int progexit; |
| 79 | 75 |
extern time_t reloaded_time; |
| 80 | 76 |
extern pthread_mutex_t reload_mutex; |
| ... | ... |
@@ -19,10 +19,6 @@ |
| 19 | 19 |
* MA 02110-1301, USA. |
| 20 | 20 |
*/ |
| 21 | 21 |
|
| 22 |
-#ifdef _MSC_VER |
|
| 23 |
-#include <winsock.h> |
|
| 24 |
-#endif |
|
| 25 |
- |
|
| 26 | 22 |
#if HAVE_CONFIG_H |
| 27 | 23 |
#include "clamav-config.h" |
| 28 | 24 |
#endif |
| ... | ... |
@@ -60,17 +56,7 @@ |
| 60 | 60 |
#include "libclamav/readdb.h" |
| 61 | 61 |
#include "libclamav/cltypes.h" |
| 62 | 62 |
|
| 63 |
-#ifndef C_WINDOWS |
|
| 64 |
-#define closesocket(s) close(s) |
|
| 65 |
-#endif |
|
| 66 |
- |
|
| 67 | 63 |
#define BUFFSIZE 1024 |
| 68 |
-#ifndef FALSE |
|
| 69 |
-#define FALSE (0) |
|
| 70 |
-#endif |
|
| 71 |
-#ifndef TRUE |
|
| 72 |
-#define TRUE (1) |
|
| 73 |
-#endif |
|
| 74 | 64 |
|
| 75 | 65 |
int progexit = 0; |
| 76 | 66 |
pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER; |
| ... | ... |
@@ -18,10 +18,6 @@ |
| 18 | 18 |
* MA 02110-1301, USA. |
| 19 | 19 |
*/ |
| 20 | 20 |
|
| 21 |
-#ifdef _MSC_VER |
|
| 22 |
-#include <winsock.h> |
|
| 23 |
-#endif |
|
| 24 |
- |
|
| 25 | 21 |
#if HAVE_CONFIG_H |
| 26 | 22 |
#include "clamav-config.h" |
| 27 | 23 |
#endif |
| ... | ... |
@@ -52,9 +48,6 @@ |
| 52 | 52 |
#include "server.h" |
| 53 | 53 |
#include "tcpserver.h" |
| 54 | 54 |
#include "misc.h" |
| 55 |
-#ifndef C_WINDOWS |
|
| 56 |
-#define closesocket(s) close(s) |
|
| 57 |
-#endif |
|
| 58 | 55 |
|
| 59 | 56 |
int tcpserver(const struct optstruct *opts) |
| 60 | 57 |
{
|
| ... | ... |
@@ -34,7 +34,9 @@ |
| 34 | 34 |
#ifdef HAVE_SYS_LIMITS_H |
| 35 | 35 |
#include <sys/limits.h> |
| 36 | 36 |
#endif |
| 37 |
+#ifdef HAVE_SYS_SELECT_H |
|
| 37 | 38 |
#include <sys/select.h> |
| 39 |
+#endif |
|
| 38 | 40 |
#include <sys/un.h> |
| 39 | 41 |
#include <netinet/in.h> |
| 40 | 42 |
#include <arpa/inet.h> |
| ... | ... |
@@ -82,6 +84,7 @@ static int isremote(const struct optstruct *opts) {
|
| 82 | 82 |
logg("!Can't parse clamd configuration file %s\n", clamd_conf);
|
| 83 | 83 |
return 0; |
| 84 | 84 |
} |
| 85 |
+#ifndef _WIN32 |
|
| 85 | 86 |
if((opt = optget(clamdopts, "LocalSocket"))->enabled) {
|
| 86 | 87 |
memset((void *)&nixsock, 0, sizeof(nixsock)); |
| 87 | 88 |
nixsock.sun_family = AF_UNIX; |
| ... | ... |
@@ -92,6 +95,7 @@ static int isremote(const struct optstruct *opts) {
|
| 92 | 92 |
optfree(clamdopts); |
| 93 | 93 |
return 0; |
| 94 | 94 |
} |
| 95 |
+#endif |
|
| 95 | 96 |
if(!(opt = optget(clamdopts, "TCPSocket"))->enabled) {
|
| 96 | 97 |
optfree(clamdopts); |
| 97 | 98 |
return 0; |
| ... | ... |
@@ -54,10 +54,6 @@ |
| 54 | 54 |
|
| 55 | 55 |
void help(void); |
| 56 | 56 |
|
| 57 |
-#if defined(C_WINDOWS) && defined(CL_DEBUG) |
|
| 58 |
-#include <crtdbg.h> |
|
| 59 |
-#endif |
|
| 60 |
- |
|
| 61 | 57 |
struct s_info info; |
| 62 | 58 |
short recursion = 0, printinfected = 0, bell = 0; |
| 63 | 59 |
|
| ... | ... |
@@ -73,13 +69,6 @@ int main(int argc, char **argv) |
| 73 | 73 |
struct optstruct *opts; |
| 74 | 74 |
const struct optstruct *opt; |
| 75 | 75 |
|
| 76 |
-#if defined(C_WINDOWS) && defined(CL_THREAD_SAFE) |
|
| 77 |
- if(!pthread_win32_process_attach_np()) {
|
|
| 78 |
- mprintf("!Can't start the win32 pthreads layer\n");
|
|
| 79 |
- return 72; |
|
| 80 |
- } |
|
| 81 |
-#endif |
|
| 82 |
- |
|
| 83 | 76 |
#if !defined(C_WINDOWS) && !defined(C_BEOS) |
| 84 | 77 |
sigemptyset(&sigset); |
| 85 | 78 |
sigaddset(&sigset, SIGXFSZ); |
| ... | ... |
@@ -156,28 +145,14 @@ int main(int argc, char **argv) |
| 156 | 156 |
|
| 157 | 157 |
memset(&info, 0, sizeof(struct s_info)); |
| 158 | 158 |
|
| 159 |
-#ifdef C_WINDOWS |
|
| 160 |
- _set_fmode(_O_BINARY); |
|
| 161 |
-#ifdef CL_DEBUG |
|
| 162 |
- {
|
|
| 163 |
- _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); |
|
| 164 |
- _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); |
|
| 165 |
- } |
|
| 166 |
-#endif |
|
| 167 |
- gettimeofday(&t1, NULL); |
|
| 168 |
-#else |
|
| 169 | 159 |
gettimeofday(&t1, &tz); |
| 170 |
-#endif |
|
| 171 | 160 |
|
| 172 | 161 |
ret = scanmanager(opts); |
| 173 | 162 |
|
| 174 | 163 |
if(!optget(opts, "no-summary")->enabled) {
|
| 175 |
-#ifdef C_WINDOWS |
|
| 176 |
- gettimeofday(&t2, NULL); |
|
| 177 |
-#else |
|
| 178 | 164 |
gettimeofday(&t2, &tz); |
| 179 |
-#endif |
|
| 180 |
- ds = t2.tv_sec - t1.tv_sec; |
|
| 165 |
+ |
|
| 166 |
+ ds = t2.tv_sec - t1.tv_sec; |
|
| 181 | 167 |
dms = t2.tv_usec - t1.tv_usec; |
| 182 | 168 |
ds -= (dms < 0) ? (1):(0); |
| 183 | 169 |
dms += (dms < 0) ? (1000000):(0); |
| ... | ... |
@@ -202,13 +177,6 @@ int main(int argc, char **argv) |
| 202 | 202 |
|
| 203 | 203 |
optfree(opts); |
| 204 | 204 |
|
| 205 |
-#if defined(C_WINDOWS) && defined(CL_THREAD_SAFE) |
|
| 206 |
- if(!pthread_win32_process_detach_np()) {
|
|
| 207 |
- logg("!Can't stop the win32 pthreads layer\n");
|
|
| 208 |
- return 72; |
|
| 209 |
- } |
|
| 210 |
-#endif |
|
| 211 |
- |
|
| 212 | 205 |
return ret; |
| 213 | 206 |
} |
| 214 | 207 |
|
| ... | ... |
@@ -129,7 +129,7 @@ static int scanfile(const char *filename, struct cl_engine *engine, const struct |
| 129 | 129 |
return 0; |
| 130 | 130 |
} |
| 131 | 131 |
info.rblocks += fsize / CL_COUNT_PRECISION; |
| 132 |
-#ifndef C_WINDOWS |
|
| 132 |
+#ifndef _WIN32 |
|
| 133 | 133 |
if(geteuid()) |
| 134 | 134 |
if(checkaccess(filename, NULL, R_OK) != 1) {
|
| 135 | 135 |
if(!printinfected) |
| ... | ... |
@@ -141,7 +141,7 @@ static int scanfile(const char *filename, struct cl_engine *engine, const struct |
| 141 | 141 |
logg("*Scanning %s\n", filename);
|
| 142 | 142 |
|
| 143 | 143 |
if((fd = open(filename, O_RDONLY|O_BINARY)) == -1) {
|
| 144 |
- logg("^Can't open file %s\n", filename);
|
|
| 144 |
+ logg("^Can't open file %s: %s\n", filename, strerror(errno));
|
|
| 145 | 145 |
return 54; |
| 146 | 146 |
} |
| 147 | 147 |
|
| ... | ... |
@@ -214,9 +214,7 @@ static int scandirs(const char *dirname, struct cl_engine *engine, const struct |
| 214 | 214 |
|
| 215 | 215 |
if((dd = opendir(dirname)) != NULL) {
|
| 216 | 216 |
while((dent = readdir(dd))) {
|
| 217 |
-#if !defined(C_INTERIX) && !defined(C_WINDOWS) |
|
| 218 | 217 |
if(dent->d_ino) |
| 219 |
-#endif |
|
| 220 | 218 |
{
|
| 221 | 219 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
|
| 222 | 220 |
/* build the full name */ |
| ... | ... |
@@ -2563,6 +2563,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu |
| 2563 | 2563 |
|
| 2564 | 2564 |
|
| 2565 | 2565 |
|
| 2566 |
+ |
|
| 2566 | 2567 |
ac_aux_dir= |
| 2567 | 2568 |
for ac_dir in config "$srcdir"/config; do |
| 2568 | 2569 |
for ac_t in install-sh install.sh shtool; do |
| ... | ... |
@@ -5129,13 +5130,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
|
| 5129 | 5129 |
else |
| 5130 | 5130 |
lt_cv_nm_interface="BSD nm" |
| 5131 | 5131 |
echo "int some_variable = 0;" > conftest.$ac_ext |
| 5132 |
- (eval echo "\"\$as_me:5132: $ac_compile\"" >&5) |
|
| 5132 |
+ (eval echo "\"\$as_me:5133: $ac_compile\"" >&5) |
|
| 5133 | 5133 |
(eval "$ac_compile" 2>conftest.err) |
| 5134 | 5134 |
cat conftest.err >&5 |
| 5135 |
- (eval echo "\"\$as_me:5135: $NM \\\"conftest.$ac_objext\\\"\"" >&5) |
|
| 5135 |
+ (eval echo "\"\$as_me:5136: $NM \\\"conftest.$ac_objext\\\"\"" >&5) |
|
| 5136 | 5136 |
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) |
| 5137 | 5137 |
cat conftest.err >&5 |
| 5138 |
- (eval echo "\"\$as_me:5138: output\"" >&5) |
|
| 5138 |
+ (eval echo "\"\$as_me:5139: output\"" >&5) |
|
| 5139 | 5139 |
cat conftest.out >&5 |
| 5140 | 5140 |
if $GREP 'External.*some_variable' conftest.out > /dev/null; then |
| 5141 | 5141 |
lt_cv_nm_interface="MS dumpbin" |
| ... | ... |
@@ -6330,7 +6331,7 @@ ia64-*-hpux*) |
| 6330 | 6330 |
;; |
| 6331 | 6331 |
*-*-irix6*) |
| 6332 | 6332 |
# Find out which ABI we are using. |
| 6333 |
- echo '#line 6333 "configure"' > conftest.$ac_ext |
|
| 6333 |
+ echo '#line 6334 "configure"' > conftest.$ac_ext |
|
| 6334 | 6334 |
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
| 6335 | 6335 |
(eval $ac_compile) 2>&5 |
| 6336 | 6336 |
ac_status=$? |
| ... | ... |
@@ -7859,11 +7860,11 @@ else |
| 7859 | 7859 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
| 7860 | 7860 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 7861 | 7861 |
-e 's:$: $lt_compiler_flag:'` |
| 7862 |
- (eval echo "\"\$as_me:7862: $lt_compile\"" >&5) |
|
| 7862 |
+ (eval echo "\"\$as_me:7863: $lt_compile\"" >&5) |
|
| 7863 | 7863 |
(eval "$lt_compile" 2>conftest.err) |
| 7864 | 7864 |
ac_status=$? |
| 7865 | 7865 |
cat conftest.err >&5 |
| 7866 |
- echo "$as_me:7866: \$? = $ac_status" >&5 |
|
| 7866 |
+ echo "$as_me:7867: \$? = $ac_status" >&5 |
|
| 7867 | 7867 |
if (exit $ac_status) && test -s "$ac_outfile"; then |
| 7868 | 7868 |
# The compiler can only warn and ignore the option if not recognized |
| 7869 | 7869 |
# So say no if there are warnings other than the usual output. |
| ... | ... |
@@ -8198,11 +8199,11 @@ else |
| 8198 | 8198 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
| 8199 | 8199 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 8200 | 8200 |
-e 's:$: $lt_compiler_flag:'` |
| 8201 |
- (eval echo "\"\$as_me:8201: $lt_compile\"" >&5) |
|
| 8201 |
+ (eval echo "\"\$as_me:8202: $lt_compile\"" >&5) |
|
| 8202 | 8202 |
(eval "$lt_compile" 2>conftest.err) |
| 8203 | 8203 |
ac_status=$? |
| 8204 | 8204 |
cat conftest.err >&5 |
| 8205 |
- echo "$as_me:8205: \$? = $ac_status" >&5 |
|
| 8205 |
+ echo "$as_me:8206: \$? = $ac_status" >&5 |
|
| 8206 | 8206 |
if (exit $ac_status) && test -s "$ac_outfile"; then |
| 8207 | 8207 |
# The compiler can only warn and ignore the option if not recognized |
| 8208 | 8208 |
# So say no if there are warnings other than the usual output. |
| ... | ... |
@@ -8303,11 +8304,11 @@ else |
| 8303 | 8303 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
| 8304 | 8304 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 8305 | 8305 |
-e 's:$: $lt_compiler_flag:'` |
| 8306 |
- (eval echo "\"\$as_me:8306: $lt_compile\"" >&5) |
|
| 8306 |
+ (eval echo "\"\$as_me:8307: $lt_compile\"" >&5) |
|
| 8307 | 8307 |
(eval "$lt_compile" 2>out/conftest.err) |
| 8308 | 8308 |
ac_status=$? |
| 8309 | 8309 |
cat out/conftest.err >&5 |
| 8310 |
- echo "$as_me:8310: \$? = $ac_status" >&5 |
|
| 8310 |
+ echo "$as_me:8311: \$? = $ac_status" >&5 |
|
| 8311 | 8311 |
if (exit $ac_status) && test -s out/conftest2.$ac_objext |
| 8312 | 8312 |
then |
| 8313 | 8313 |
# The compiler can only warn and ignore the option if not recognized |
| ... | ... |
@@ -8358,11 +8359,11 @@ else |
| 8358 | 8358 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
| 8359 | 8359 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 8360 | 8360 |
-e 's:$: $lt_compiler_flag:'` |
| 8361 |
- (eval echo "\"\$as_me:8361: $lt_compile\"" >&5) |
|
| 8361 |
+ (eval echo "\"\$as_me:8362: $lt_compile\"" >&5) |
|
| 8362 | 8362 |
(eval "$lt_compile" 2>out/conftest.err) |
| 8363 | 8363 |
ac_status=$? |
| 8364 | 8364 |
cat out/conftest.err >&5 |
| 8365 |
- echo "$as_me:8365: \$? = $ac_status" >&5 |
|
| 8365 |
+ echo "$as_me:8366: \$? = $ac_status" >&5 |
|
| 8366 | 8366 |
if (exit $ac_status) && test -s out/conftest2.$ac_objext |
| 8367 | 8367 |
then |
| 8368 | 8368 |
# The compiler can only warn and ignore the option if not recognized |
| ... | ... |
@@ -10741,7 +10742,7 @@ else |
| 10741 | 10741 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
| 10742 | 10742 |
lt_status=$lt_dlunknown |
| 10743 | 10743 |
cat > conftest.$ac_ext <<_LT_EOF |
| 10744 |
-#line 10744 "configure" |
|
| 10744 |
+#line 10745 "configure" |
|
| 10745 | 10745 |
#include "confdefs.h" |
| 10746 | 10746 |
|
| 10747 | 10747 |
#if HAVE_DLFCN_H |
| ... | ... |
@@ -10837,7 +10838,7 @@ else |
| 10837 | 10837 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
| 10838 | 10838 |
lt_status=$lt_dlunknown |
| 10839 | 10839 |
cat > conftest.$ac_ext <<_LT_EOF |
| 10840 |
-#line 10840 "configure" |
|
| 10840 |
+#line 10841 "configure" |
|
| 10841 | 10841 |
#include "confdefs.h" |
| 10842 | 10842 |
|
| 10843 | 10843 |
#if HAVE_DLFCN_H |
| ... | ... |
@@ -11509,7 +11510,7 @@ else |
| 11509 | 11509 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
| 11510 | 11510 |
lt_status=$lt_dlunknown |
| 11511 | 11511 |
cat > conftest.$ac_ext <<_LT_EOF |
| 11512 |
-#line 11512 "configure" |
|
| 11512 |
+#line 11513 "configure" |
|
| 11513 | 11513 |
#include "confdefs.h" |
| 11514 | 11514 |
|
| 11515 | 11515 |
#if HAVE_DLFCN_H |
| ... | ... |
@@ -22,6 +22,7 @@ dnl For a release change [devel] to the real version [0.xy] |
| 22 | 22 |
dnl also change VERSION below |
| 23 | 23 |
AC_INIT([ClamAV], [devel], [http://bugs.clamav.net/], [clamav], [http://www.clamav.net/]) |
| 24 | 24 |
|
| 25 |
+AH_BOTTOM([#include "platform.h"]) |
|
| 25 | 26 |
dnl put configure auxiliary into config |
| 26 | 27 |
AC_CONFIG_AUX_DIR([config]) |
| 27 | 28 |
AC_CONFIG_HEADER([clamav-config.h]) |
| ... | ... |
@@ -28,9 +28,6 @@ |
| 28 | 28 |
#endif |
| 29 | 29 |
#include <string.h> |
| 30 | 30 |
#include <errno.h> |
| 31 |
-#ifdef C_WINDOWS |
|
| 32 |
-#include <process.h> |
|
| 33 |
-#endif |
|
| 34 | 31 |
|
| 35 | 32 |
#include "shared/output.h" |
| 36 | 33 |
#include "shared/optparser.h" |
| ... | ... |
@@ -58,7 +55,7 @@ void execute( const char *type, const char *text, const struct optstruct *opts ) |
| 58 | 58 |
return; |
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 |
-#ifdef C_WINDOWS |
|
| 61 |
+#ifdef _WIN32 |
|
| 62 | 62 |
if(active_children < MAX_CHILDREN) {
|
| 63 | 63 |
if(spawnlp(P_DETACH, text, text, NULL) == -1) {
|
| 64 | 64 |
logg("^%s: couldn't execute \"%s\".\n", type, text);
|
| ... | ... |
@@ -15,9 +15,6 @@ |
| 15 | 15 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 16 | 16 |
* MA 02110-1301, USA. |
| 17 | 17 |
*/ |
| 18 |
-#ifdef _MSC_VER |
|
| 19 |
-#include <winsock.h> |
|
| 20 |
-#endif |
|
| 21 | 18 |
|
| 22 | 19 |
#if HAVE_CONFIG_H |
| 23 | 20 |
#include "clamav-config.h" |
| ... | ... |
@@ -131,9 +128,11 @@ static void help(void) |
| 131 | 131 |
mprintf("\n");
|
| 132 | 132 |
mprintf(" --config-file=FILE read configuration from FILE.\n");
|
| 133 | 133 |
mprintf(" --log=FILE -l FILE log into FILE\n");
|
| 134 |
+#ifndef _WIN32 |
|
| 134 | 135 |
mprintf(" --daemon -d run in daemon mode\n");
|
| 135 | 136 |
mprintf(" --pid=FILE -p FILE save daemon's pid in FILE\n");
|
| 136 | 137 |
mprintf(" --user=USER -u USER run as USER\n");
|
| 138 |
+#endif |
|
| 137 | 139 |
mprintf(" --no-dns force old non-DNS verification method\n");
|
| 138 | 140 |
mprintf(" --checks=#n -c #n number of checks per day, 1 <= n <= 50\n");
|
| 139 | 141 |
mprintf(" --datadir=DIRECTORY download new databases into DIRECTORY\n");
|
| ... | ... |
@@ -239,14 +238,6 @@ int main(int argc, char **argv) |
| 239 | 239 |
return 0; |
| 240 | 240 |
} |
| 241 | 241 |
|
| 242 |
-#ifdef C_WINDOWS |
|
| 243 |
- if(!pthread_win32_process_attach_np()) {
|
|
| 244 |
- mprintf("!Can't start the win32 pthreads layer\n");
|
|
| 245 |
- optfree(opts); |
|
| 246 |
- return 63; |
|
| 247 |
- } |
|
| 248 |
-#endif |
|
| 249 |
- |
|
| 250 | 242 |
if(optget(opts, "HTTPProxyPassword")->enabled) {
|
| 251 | 243 |
if(stat(cfgfile, &statbuf) == -1) {
|
| 252 | 244 |
logg("^Can't stat %s (critical error)\n", cfgfile);
|
| ... | ... |
@@ -254,7 +245,7 @@ int main(int argc, char **argv) |
| 254 | 254 |
return 56; |
| 255 | 255 |
} |
| 256 | 256 |
|
| 257 |
-#ifndef C_WINDOWS |
|
| 257 |
+#ifndef _WIN32 |
|
| 258 | 258 |
if(statbuf.st_mode & (S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)) {
|
| 259 | 259 |
logg("^Insecure permissions (for HTTPProxyPassword): %s must have no more than 0700 permissions.\n", cfgfile);
|
| 260 | 260 |
optfree(opts); |
| ... | ... |
@@ -263,7 +254,7 @@ int main(int argc, char **argv) |
| 263 | 263 |
#endif |
| 264 | 264 |
} |
| 265 | 265 |
|
| 266 |
-#if !defined(C_OS2) && !defined(C_WINDOWS) |
|
| 266 |
+#if !defined(C_OS2) && !defined(_WIN32) |
|
| 267 | 267 |
/* freshclam shouldn't work with root privileges */ |
| 268 | 268 |
dbowner = optget(opts, "DatabaseOwner")->strarg; |
| 269 | 269 |
|
| ... | ... |
@@ -378,18 +369,6 @@ int main(int argc, char **argv) |
| 378 | 378 |
return 0; |
| 379 | 379 |
} |
| 380 | 380 |
|
| 381 |
-#ifdef C_WINDOWS |
|
| 382 |
- {
|
|
| 383 |
- WSADATA wsaData; |
|
| 384 |
- |
|
| 385 |
- if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
|
|
| 386 |
- logg("!Error at WSAStartup(): %d\n", WSAGetLastError());
|
|
| 387 |
- optfree(opts); |
|
| 388 |
- return 1; |
|
| 389 |
- } |
|
| 390 |
- } |
|
| 391 |
-#endif |
|
| 392 |
- |
|
| 393 | 381 |
if(optget(opts, "daemon")->enabled) {
|
| 394 | 382 |
int bigsleep, checks; |
| 395 | 383 |
#ifndef C_WINDOWS |
| ... | ... |
@@ -417,7 +396,7 @@ int main(int argc, char **argv) |
| 417 | 417 |
|
| 418 | 418 |
bigsleep = 24 * 3600 / checks; |
| 419 | 419 |
|
| 420 |
-#if !defined(C_OS2) && !defined(C_WINDOWS) |
|
| 420 |
+#if !defined(C_OS2) && !defined(_WIN32) |
|
| 421 | 421 |
if(!optget(opts, "Foreground")->enabled) {
|
| 422 | 422 |
if(daemonize() == -1) {
|
| 423 | 423 |
logg("!daemonize() failed\n");
|
| ... | ... |
@@ -472,7 +451,7 @@ int main(int argc, char **argv) |
| 472 | 472 |
sigaction(SIGUSR1, &sigact, &oldact); |
| 473 | 473 |
#endif |
| 474 | 474 |
|
| 475 |
-#ifdef C_WINDOWS |
|
| 475 |
+#ifdef _WIN32 |
|
| 476 | 476 |
sleep(bigsleep); |
| 477 | 477 |
#else |
| 478 | 478 |
time(&wakeup); |
| ... | ... |
@@ -525,14 +504,5 @@ int main(int argc, char **argv) |
| 525 | 525 |
|
| 526 | 526 |
optfree(opts); |
| 527 | 527 |
|
| 528 |
-#ifdef C_WINDOWS |
|
| 529 |
- WSACleanup(); |
|
| 530 |
- |
|
| 531 |
- if(!pthread_win32_process_detach_np()) {
|
|
| 532 |
- mprintf("!Can't stop the win32 pthreads layer\n");
|
|
| 533 |
- return 63; |
|
| 534 |
- } |
|
| 535 |
-#endif |
|
| 536 |
- |
|
| 537 | 528 |
return(ret); |
| 538 | 529 |
} |
| ... | ... |
@@ -22,9 +22,6 @@ |
| 22 | 22 |
* MA 02110-1301, USA. |
| 23 | 23 |
*/ |
| 24 | 24 |
|
| 25 |
-#ifdef _MSC_VER |
|
| 26 |
-#include <winsock.h> /* only needed in CL_EXPERIMENTAL */ |
|
| 27 |
-#endif |
|
| 28 | 25 |
#if HAVE_CONFIG_H |
| 29 | 26 |
#include "clamav-config.h" |
| 30 | 27 |
#endif |
| ... | ... |
@@ -59,9 +56,7 @@ |
| 59 | 59 |
#include <time.h> |
| 60 | 60 |
#include <fcntl.h> |
| 61 | 61 |
#include <sys/stat.h> |
| 62 |
-#ifndef C_WINDOWS |
|
| 63 | 62 |
#include <dirent.h> |
| 64 |
-#endif |
|
| 65 | 63 |
#include <errno.h> |
| 66 | 64 |
#include <zlib.h> |
| 67 | 65 |
|
| ... | ... |
@@ -85,14 +80,6 @@ |
| 85 | 85 |
#include "libclamav/str.h" |
| 86 | 86 |
#include "libclamav/cvd.h" |
| 87 | 87 |
|
| 88 |
-#ifndef O_BINARY |
|
| 89 |
-#define O_BINARY 0 |
|
| 90 |
-#endif |
|
| 91 |
- |
|
| 92 |
-#ifndef C_WINDOWS |
|
| 93 |
-#define closesocket(s) close(s) |
|
| 94 |
-#endif |
|
| 95 |
- |
|
| 96 | 88 |
#define CHDIR_ERR(x) \ |
| 97 | 89 |
if(chdir(x) == -1) \ |
| 98 | 90 |
logg("!Can't chdir to %s\n", x);
|
| ... | ... |
@@ -1419,9 +1406,7 @@ static int buildcld(const char *tmpdir, const char *dbname, const char *newfile, |
| 1419 | 1419 |
} |
| 1420 | 1420 |
|
| 1421 | 1421 |
while((dent = readdir(dir))) {
|
| 1422 |
-#if !defined(C_INTERIX) && !defined(C_WINDOWS) |
|
| 1423 | 1422 |
if(dent->d_ino) |
| 1424 |
-#endif |
|
| 1425 | 1423 |
{
|
| 1426 | 1424 |
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") || !strcmp(dent->d_name, "COPYING") || !strcmp(dent->d_name, "daily.cfg")) |
| 1427 | 1425 |
continue; |
| ... | ... |
@@ -1683,7 +1668,7 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig |
| 1683 | 1683 |
return 55; /* FIXME */ |
| 1684 | 1684 |
} |
| 1685 | 1685 |
|
| 1686 |
-#ifdef C_WINDOWS |
|
| 1686 |
+#ifdef _WIN32 |
|
| 1687 | 1687 |
if(!access(newdb, R_OK) && unlink(newdb)) {
|
| 1688 | 1688 |
logg("!Can't unlink %s. Please fix the problem manually and try again.\n", newdb);
|
| 1689 | 1689 |
unlink(newfile); |
| ... | ... |
@@ -15,11 +15,6 @@ |
| 15 | 15 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 16 | 16 |
* MA 02110-1301, USA. |
| 17 | 17 |
*/ |
| 18 |
-#ifdef _MSC_VER |
|
| 19 |
-#include <windows.h> |
|
| 20 |
-#include <winsock.h> |
|
| 21 |
-#endif |
|
| 22 |
- |
|
| 23 | 18 |
|
| 24 | 19 |
#if HAVE_CONFIG_H |
| 25 | 20 |
#include "clamav-config.h" |
| ... | ... |
@@ -45,10 +40,6 @@ |
| 45 | 45 |
#include "shared/output.h" |
| 46 | 46 |
#include "notify.h" |
| 47 | 47 |
|
| 48 |
-#ifndef C_WINDOWS |
|
| 49 |
-#define closesocket(s) close(s) |
|
| 50 |
-#endif |
|
| 51 |
- |
|
| 52 | 48 |
int notify(const char *cfgfile) |
| 53 | 49 |
{
|
| 54 | 50 |
char buff[20]; |
| ... | ... |
@@ -24,11 +24,6 @@ static char const rcsid[] = "$Id: blob.c,v 1.64 2007/02/12 22:25:14 njh Exp $"; |
| 24 | 24 |
#include "clamav-config.h" |
| 25 | 25 |
#endif |
| 26 | 26 |
|
| 27 |
-#ifdef C_WINDOWS |
|
| 28 |
-#include "stdafx.h" |
|
| 29 |
-#include <io.h> |
|
| 30 |
-#endif |
|
| 31 |
- |
|
| 32 | 27 |
#include <stdio.h> |
| 33 | 28 |
#include <stdlib.h> |
| 34 | 29 |
#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 $"; |
| 59 | 59 |
|
| 60 | 60 |
#include <assert.h> |
| 61 | 61 |
|
| 62 |
-#if defined(C_MINGW) || defined(C_WINDOWS) |
|
| 63 |
-#include <windows.h> |
|
| 64 |
-#endif |
|
| 65 |
- |
|
| 66 | 62 |
/* Scehduled for rewite in 0.94 (bb#804). Disabling for now */ |
| 67 | 63 |
/* #define MAX_SCAN_SIZE 20*1024 /\* */ |
| 68 | 64 |
/* * The performance benefit of scanning */ |
| ... | ... |
@@ -689,7 +680,7 @@ sanitiseName(char *name) |
| 689 | 689 |
* I don't know if spaces are legal in OS/2. |
| 690 | 690 |
*/ |
| 691 | 691 |
if(strchr("%/*?<>|\\\"+=,;:\t ~", *name))
|
| 692 |
-#elif defined(C_WINDOWS) |
|
| 692 |
+#elif defined(_WIN32) |
|
| 693 | 693 |
if(strchr("%/*?<>|\\\"+=,;:\t~", *name))
|
| 694 | 694 |
#else |
| 695 | 695 |
if(*name == '/') |
| ... | ... |
@@ -769,7 +769,7 @@ static int chm_decompress_stream(int fd, chm_metadata_t *metadata, const char *d |
| 769 | 769 |
lzx_decompress(stream, length); |
| 770 | 770 |
lzx_free(stream); |
| 771 | 771 |
|
| 772 |
-#ifndef C_WINDOWS |
|
| 772 |
+#ifndef _WIN32 |
|
| 773 | 773 |
/* Delete the file */ |
| 774 | 774 |
if(cli_unlink(filename)) |
| 775 | 775 |
retval = -1; |
| ... | ... |
@@ -20,10 +20,6 @@ |
| 20 | 20 |
|
| 21 | 21 |
static char const rcsid[] = "$Id: mbox.c,v 1.381 2007/02/15 12:26:44 njh Exp $"; |
| 22 | 22 |
|
| 23 |
-#ifdef _MSC_VER |
|
| 24 |
-#include <winsock.h> /* only needed in CL_EXPERIMENTAL */ |
|
| 25 |
-#endif |
|
| 26 |
- |
|
| 27 | 23 |
#if HAVE_CONFIG_H |
| 28 | 24 |
#include "clamav-config.h" |
| 29 | 25 |
#endif |
| ... | ... |
@@ -54,9 +50,7 @@ static char const rcsid[] = "$Id: mbox.c,v 1.381 2007/02/15 12:26:44 njh Exp $"; |
| 54 | 54 |
#include <sys/param.h> |
| 55 | 55 |
#endif |
| 56 | 56 |
#include "clamav.h" |
| 57 |
-#ifndef C_WINDOWS |
|
| 58 | 57 |
#include <dirent.h> |
| 59 |
-#endif |
|
| 60 | 58 |
#include <limits.h> |
| 61 | 59 |
#include <signal.h> |
| 62 | 60 |
|
| ... | ... |
@@ -141,7 +135,7 @@ typedef enum {
|
| 141 | 141 |
|
| 142 | 142 |
#include "phishcheck.h" |
| 143 | 143 |
|
| 144 |
-#ifndef C_WINDOWS |
|
| 144 |
+#ifndef _WIN32 |
|
| 145 | 145 |
#include <netdb.h> |
| 146 | 146 |
#include <sys/socket.h> |
| 147 | 147 |
#include <netinet/in.h> |
| ... | ... |
@@ -151,10 +145,6 @@ typedef enum {
|
| 151 | 151 |
#endif |
| 152 | 152 |
#endif |
| 153 | 153 |
|
| 154 |
-#ifndef C_WINDOWS |
|
| 155 |
-#define closesocket(s) close(s) |
|
| 156 |
-#define SOCKET int |
|
| 157 |
-#endif |
|
| 158 | 154 |
|
| 159 | 155 |
#include <fcntl.h> |
| 160 | 156 |
#ifndef C_WINDOWS |
| ... | ... |
@@ -169,16 +159,6 @@ typedef unsigned short in_port_t; |
| 169 | 169 |
typedef unsigned int in_addr_t; |
| 170 | 170 |
#endif |
| 171 | 171 |
|
| 172 |
-#if (!defined(EALREADY)) && (defined(WSAEALREADY)) |
|
| 173 |
-#define EALREADY WSAEALREADY |
|
| 174 |
-#endif |
|
| 175 |
-#if (!defined(EINPROGRESS)) && (defined(WSAEINPROGRESS)) |
|
| 176 |
-#define EINPROGRESS WSAEINPROGRESS |
|
| 177 |
-#endif |
|
| 178 |
-#if (!defined(EISCONN)) && (defined(WSAEISCONN)) |
|
| 179 |
-#define EISCONN WSAEISCONN |
|
| 180 |
-#endif |
|
| 181 |
- |
|
| 182 | 172 |
/* |
| 183 | 173 |
* Use CL_SCAN_PARTIAL_MESSAGE to handle messages covered by section 7.3.2 of RFC1341. |
| 184 | 174 |
* 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) |
| 3826 | 3826 |
int nblanks; |
| 3827 | 3827 |
struct stat statb; |
| 3828 | 3828 |
const char *dentry_idpart; |
| 3829 |
-#ifndef C_WINDOWS |
|
| 3829 |
+ |
|
| 3830 | 3830 |
if(dent->d_ino == 0) |
| 3831 | 3831 |
continue; |
| 3832 |
-#endif |
|
| 3833 | 3832 |
|
| 3834 | 3833 |
if(!strcmp(".",dent->d_name) ||
|
| 3835 | 3834 |
!strcmp("..", dent->d_name))
|
| ... | ... |
@@ -18,6 +18,9 @@ |
| 18 | 18 |
* MA 02110-1301, USA. |
| 19 | 19 |
*/ |
| 20 | 20 |
|
| 21 |
+#ifndef __MBOX_H |
|
| 22 |
+#define __MBOX_H |
|
| 23 |
+ |
|
| 21 | 24 |
/* See RFC1521 */ |
| 22 | 25 |
typedef enum {
|
| 23 | 26 |
NOMIME, APPLICATION, AUDIO, IMAGE, MESSAGE, MULTIPART, TEXT, VIDEO, MEXTENSION |
| ... | ... |
@@ -48,3 +51,5 @@ typedef enum {
|
| 48 | 48 |
|
| 49 | 49 |
size_t strstrip(char *s); /* remove trailing white space */ |
| 50 | 50 |
int cli_mbox(const char *dir, int desc, cli_ctx *ctx); |
| 51 |
+ |
|
| 52 |
+#endif /* __MBOX_H */ |
| ... | ... |
@@ -54,9 +54,6 @@ |
| 54 | 54 |
#ifdef HAVE_MALLOC_H |
| 55 | 55 |
#include <malloc.h> |
| 56 | 56 |
#endif |
| 57 |
-#if defined(_MSC_VER) && defined(_DEBUG) |
|
| 58 |
-#include <crtdbg.h> |
|
| 59 |
-#endif |
|
| 60 | 57 |
|
| 61 | 58 |
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2) |
| 62 | 59 |
#include <limits.h> |
| ... | ... |
@@ -784,9 +781,7 @@ int cli_rmdirs(const char *dirname) |
| 784 | 784 |
#else |
| 785 | 785 |
while((dent = readdir(dd))) {
|
| 786 | 786 |
#endif |
| 787 |
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) |
|
| 788 | 787 |
if(dent->d_ino) |
| 789 |
-#endif |
|
| 790 | 788 |
{
|
| 791 | 789 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
|
| 792 | 790 |
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) |
| 901 | 901 |
|
| 902 | 902 |
#define BITS_PER_CHAR (8) |
| 903 | 903 |
#define BITSET_DEFAULT_SIZE (1024) |
| 904 |
-#define FALSE (0) |
|
| 905 |
-#define TRUE (1) |
|
| 906 | 904 |
|
| 907 | 905 |
static unsigned long nearest_power(unsigned long num) |
| 908 | 906 |
{
|
| ... | ... |
@@ -316,21 +316,6 @@ static inline void cli_writeint32(char *offset, uint32_t value) |
| 316 | 316 |
#endif |
| 317 | 317 |
#define CLI_SAR(n,s) n = CLI_SRS(n,s) |
| 318 | 318 |
|
| 319 |
-#ifndef FALSE |
|
| 320 |
-#define FALSE (0) |
|
| 321 |
-#endif |
|
| 322 |
- |
|
| 323 |
-#ifndef TRUE |
|
| 324 |
-#define TRUE (1) |
|
| 325 |
-#endif |
|
| 326 |
- |
|
| 327 |
-#ifndef MIN |
|
| 328 |
-#define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
|
| 329 |
-#endif |
|
| 330 |
-#ifndef MAX |
|
| 331 |
-#define MAX(a,b) (((a) > (b)) ? (a) : (b)) |
|
| 332 |
-#endif |
|
| 333 |
- |
|
| 334 | 319 |
typedef struct bitset_tag |
| 335 | 320 |
{
|
| 336 | 321 |
unsigned char *bitset; |
| ... | ... |
@@ -54,9 +54,6 @@ |
| 54 | 54 |
#ifdef HAVE_MALLOC_H |
| 55 | 55 |
#include <malloc.h> |
| 56 | 56 |
#endif |
| 57 |
-#if defined(_MSC_VER) && defined(_DEBUG) |
|
| 58 |
-#include <crtdbg.h> |
|
| 59 |
-#endif |
|
| 60 | 57 |
|
| 61 | 58 |
#include "clamav.h" |
| 62 | 59 |
#include "others.h" |
| ... | ... |
@@ -138,11 +135,7 @@ void *cli_malloc(size_t size) |
| 138 | 138 |
return NULL; |
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 |
-#if defined(_MSC_VER) && defined(_DEBUG) |
|
| 142 |
- alloc = _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__); |
|
| 143 |
-#else |
|
| 144 | 141 |
alloc = malloc(size); |
| 145 |
-#endif |
|
| 146 | 142 |
|
| 147 | 143 |
if(!alloc) {
|
| 148 | 144 |
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) |
| 161 | 161 |
return NULL; |
| 162 | 162 |
} |
| 163 | 163 |
|
| 164 |
-#if defined(_MSC_VER) && defined(_DEBUG) |
|
| 165 |
- alloc = _calloc_dbg(nmemb, size, _NORMAL_BLOCK, __FILE__, __LINE__); |
|
| 166 |
-#else |
|
| 167 | 164 |
alloc = calloc(nmemb, size); |
| 168 |
-#endif |
|
| 169 | 165 |
|
| 170 | 166 |
if(!alloc) {
|
| 171 | 167 |
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) |
| 224 | 224 |
return NULL; |
| 225 | 225 |
} |
| 226 | 226 |
|
| 227 |
-#if defined(_MSC_VER) && defined(_DEBUG) |
|
| 228 |
- alloc = _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__); |
|
| 229 |
-#else |
|
| 230 | 227 |
alloc = strdup(s); |
| 231 |
-#endif |
|
| 232 | 228 |
|
| 233 | 229 |
if(!alloc) {
|
| 234 | 230 |
cli_errmsg("cli_strdup(): Can't allocate memory (%u bytes).\n", (unsigned int) strlen(s));
|
| ... | ... |
@@ -322,9 +322,6 @@ static int build_regex(regex_t* preg,const char* regex,int nosub) |
| 322 | 322 |
rc = cli_regcomp(preg,regex,REG_EXTENDED|REG_ICASE|(nosub ? REG_NOSUB :0)); |
| 323 | 323 |
if(rc) {
|
| 324 | 324 |
|
| 325 |
-#ifdef C_WINDOWS |
|
| 326 |
- cli_errmsg("Phishcheck: Error in compiling regex, disabling phishing checks\n");
|
|
| 327 |
-#else |
|
| 328 | 325 |
size_t buflen = cli_regerror(rc,preg,NULL,0); |
| 329 | 326 |
char *errbuf = cli_malloc(buflen); |
| 330 | 327 |
|
| ... | ... |
@@ -334,7 +331,6 @@ static int build_regex(regex_t* preg,const char* regex,int nosub) |
| 334 | 334 |
free(errbuf); |
| 335 | 335 |
} else |
| 336 | 336 |
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");
|
| 337 |
-#endif |
|
| 338 | 337 |
return 1; |
| 339 | 338 |
} |
| 340 | 339 |
return CL_SUCCESS; |
| ... | ... |
@@ -29,9 +29,7 @@ |
| 29 | 29 |
#ifdef HAVE_UNISTD_H |
| 30 | 30 |
#include <unistd.h> |
| 31 | 31 |
#endif |
| 32 |
-#ifndef C_WINDOWS |
|
| 33 | 32 |
#include <dirent.h> |
| 34 |
-#endif |
|
| 35 | 33 |
#include <sys/types.h> |
| 36 | 34 |
#include <sys/stat.h> |
| 37 | 35 |
#ifdef HAVE_SYS_PARAM_H |
| ... | ... |
@@ -1549,13 +1547,7 @@ int cli_load(const char *filename, struct cl_engine *engine, unsigned int *signo |
| 1549 | 1549 |
return CL_EOPEN; |
| 1550 | 1550 |
} |
| 1551 | 1551 |
|
| 1552 |
-/* |
|
| 1553 |
-#ifdef C_WINDOWS |
|
| 1554 |
- if((dbname = strrchr(filename, '\\'))) |
|
| 1555 |
-#else |
|
| 1556 |
-*/ |
|
| 1557 | 1552 |
if((dbname = strrchr(filename, '/'))) |
| 1558 |
-/*#endif */ |
|
| 1559 | 1553 |
dbname++; |
| 1560 | 1554 |
else |
| 1561 | 1555 |
dbname = filename; |
| ... | ... |
@@ -1723,9 +1715,7 @@ static int cli_loaddbdir(const char *dirname, struct cl_engine *engine, unsigned |
| 1723 | 1723 |
#else |
| 1724 | 1724 |
while((dent = readdir(dd))) {
|
| 1725 | 1725 |
#endif |
| 1726 |
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) |
|
| 1727 | 1726 |
if(dent->d_ino) |
| 1728 |
-#endif |
|
| 1729 | 1727 |
{
|
| 1730 | 1728 |
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)) {
|
| 1731 | 1729 |
|
| ... | ... |
@@ -1842,9 +1832,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat) |
| 1842 | 1842 |
#else |
| 1843 | 1843 |
while((dent = readdir(dd))) {
|
| 1844 | 1844 |
#endif |
| 1845 |
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) |
|
| 1846 | 1845 |
if(dent->d_ino) |
| 1847 |
-#endif |
|
| 1848 | 1846 |
{
|
| 1849 | 1847 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && CLI_DBEXT(dent->d_name)) {
|
| 1850 | 1848 |
dbstat->entries++; |
| ... | ... |
@@ -1925,9 +1913,7 @@ int cl_statchkdir(const struct cl_stat *dbstat) |
| 1925 | 1925 |
#else |
| 1926 | 1926 |
while((dent = readdir(dd))) {
|
| 1927 | 1927 |
#endif |
| 1928 |
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) |
|
| 1929 | 1928 |
if(dent->d_ino) |
| 1930 |
-#endif |
|
| 1931 | 1929 |
{
|
| 1932 | 1930 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && CLI_DBEXT(dent->d_name)) {
|
| 1933 | 1931 |
fname = cli_malloc(strlen(dbstat->dir) + strlen(dent->d_name) + 32); |
| ... | ... |
@@ -130,9 +130,7 @@ static int cli_scandir(const char *dirname, cli_ctx *ctx) |
| 130 | 130 |
#else |
| 131 | 131 |
while((dent = readdir(dd))) {
|
| 132 | 132 |
#endif |
| 133 |
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) |
|
| 134 | 133 |
if(dent->d_ino) |
| 135 |
-#endif |
|
| 136 | 134 |
{
|
| 137 | 135 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
|
| 138 | 136 |
/* build the full name */ |
| ... | ... |
@@ -882,9 +880,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx, struct uniq *U) |
| 882 | 882 |
#else |
| 883 | 883 |
while((dent = readdir(dd))) {
|
| 884 | 884 |
#endif |
| 885 |
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) |
|
| 886 | 885 |
if(dent->d_ino) |
| 887 |
-#endif |
|
| 888 | 886 |
{
|
| 889 | 887 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
|
| 890 | 888 |
/* build the full name */ |
| ... | ... |
@@ -41,6 +41,9 @@ |
| 41 | 41 |
* |
| 42 | 42 |
*/ |
| 43 | 43 |
|
| 44 |
+#ifndef __TEXT_H |
|
| 45 |
+#define __TEXT_H |
|
| 46 |
+ |
|
| 44 | 47 |
/* The contents could change, ONLY access in text.c */ |
| 45 | 48 |
typedef struct text {
|
| 46 | 49 |
line_t *t_line; /* NULL if the line is empty */ |
| ... | ... |
@@ -54,3 +57,5 @@ text *textAddMessage(text *aText, message *aMessage); |
| 54 | 54 |
text *textMove(text *t_head, text *t); |
| 55 | 55 |
blob *textToBlob(text *t, blob *b, int destroy); |
| 56 | 56 |
fileblob *textToFileblob(text *t, fileblob *fb, int destroy); |
| 57 |
+ |
|
| 58 |
+#endif /* __TEXT_H */ |
| ... | ... |
@@ -35,12 +35,6 @@ struct unpack_data_tag; |
| 35 | 35 |
#include "libclamunrar/unrarcmd.h" |
| 36 | 36 |
#include "libclamunrar/unrarfilter.h" |
| 37 | 37 |
|
| 38 |
-#define FALSE (0) |
|
| 39 |
-#define TRUE (1) |
|
| 40 |
-#ifndef MIN |
|
| 41 |
-#define MIN(a,b) ((a < b) ? a : b) |
|
| 42 |
-#endif |
|
| 43 |
- |
|
| 44 | 38 |
#define SIZEOF_MARKHEAD 7 |
| 45 | 39 |
#define SIZEOF_NEWMHD 13 |
| 46 | 40 |
#define SIZEOF_NEWLHD 32 |
| ... | ... |
@@ -27,15 +27,10 @@ void *rar_malloc(size_t size) |
| 27 | 27 |
return NULL; |
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 |
-#if defined(_MSC_VER) && defined(_DEBUG) |
|
| 31 |
- alloc = _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__); |
|
| 32 |
-#else |
|
| 33 | 30 |
alloc = malloc(size); |
| 34 |
-#endif |
|
| 35 | 31 |
|
| 36 | 32 |
if(!alloc) {
|
| 37 | 33 |
fprintf(stderr, "UNRAR: rar_malloc(): Can't allocate memory (%lu bytes).\n", size); |
| 38 |
- perror("malloc_problem");
|
|
| 39 | 34 |
return NULL; |
| 40 | 35 |
} else return alloc; |
| 41 | 36 |
} |
| ... | ... |
@@ -54,7 +49,6 @@ void *rar_realloc2(void *ptr, size_t size) |
| 54 | 54 |
|
| 55 | 55 |
if(!alloc) {
|
| 56 | 56 |
fprintf(stderr, "UNRAR: rar_realloc2(): Can't allocate memory (%lu bytes).\n", size); |
| 57 |
- perror("rar_realloc2");
|
|
| 58 | 57 |
if(ptr) |
| 59 | 58 |
free(ptr); |
| 60 | 59 |
return NULL; |
| ... | ... |
@@ -535,23 +535,3 @@ void unrar_close(unrar_state_t *state) |
| 535 | 535 |
free(state->unpack_data); |
| 536 | 536 |
free(state->comment_dir); |
| 537 | 537 |
} |
| 538 |
- |
|
| 539 |
-#ifdef C_WINDOWS |
|
| 540 |
-/* |
|
| 541 |
- * A copy is needed here to avoid a cyclic dependancy libclamunrar_iface<->libclamav |
|
| 542 |
- * e.g. see the comment in bug 775 about dropping the old internal snprintf |
|
| 543 |
- * which didn't have this problem and bug 785 |
|
| 544 |
- */ |
|
| 545 |
-#include <stdarg.h> |
|
| 546 |
-static int |
|
| 547 |
-snprintf(char *str, size_t size, const char *format, ...) |
|
| 548 |
-{
|
|
| 549 |
- int ret; |
|
| 550 |
- |
|
| 551 |
- va_list args; |
|
| 552 |
- va_start(args, format); |
|
| 553 |
- ret = _vsnprintf_s(str, size, _TRUNCATE, format, args); |
|
| 554 |
- va_end(args); |
|
| 555 |
- return ret; |
|
| 556 |
-} |
|
| 557 |
-#endif |
| 558 | 538 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,21 @@ |
| 0 |
+#ifndef _WIN32 |
|
| 1 |
+#define closesocket(s) close(s) |
|
| 2 |
+#endif |
|
| 3 |
+ |
|
| 4 |
+#ifndef O_BINARY |
|
| 5 |
+#define O_BINARY 0 |
|
| 6 |
+#endif |
|
| 7 |
+ |
|
| 8 |
+#ifndef FALSE |
|
| 9 |
+#define FALSE (0) |
|
| 10 |
+#endif |
|
| 11 |
+#ifndef TRUE |
|
| 12 |
+#define TRUE (1) |
|
| 13 |
+#endif |
|
| 14 |
+ |
|
| 15 |
+#ifndef MIN |
|
| 16 |
+#define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
|
| 17 |
+#endif |
|
| 18 |
+#ifndef MAX |
|
| 19 |
+#define MAX(a,b) (((a) > (b)) ? (a) : (b)) |
|
| 20 |
+#endif |
| ... | ... |
@@ -32,9 +32,7 @@ |
| 32 | 32 |
#include <sys/types.h> |
| 33 | 33 |
#include <sys/stat.h> |
| 34 | 34 |
#include <sys/socket.h> |
| 35 |
-#ifndef C_WINDOWS |
|
| 36 | 35 |
#include <dirent.h> |
| 37 |
-#endif |
|
| 38 | 36 |
#include <fcntl.h> |
| 39 | 37 |
#include <ctype.h> |
| 40 | 38 |
#include <errno.h> |
| ... | ... |
@@ -225,7 +223,7 @@ int filecopy(const char *src, const char *dest) |
| 225 | 225 |
|
| 226 | 226 |
int daemonize(void) |
| 227 | 227 |
{
|
| 228 |
-#if defined(C_OS2) || defined(C_WINDOWS) |
|
| 228 |
+#if defined(C_OS2) || defined(_WIN32) |
|
| 229 | 229 |
fputs("Background mode is not supported on your operating system\n", stderr);
|
| 230 | 230 |
return -1; |
| 231 | 231 |
#else |
| ... | ... |
@@ -987,9 +987,7 @@ static int listdir(const char *dirname) |
| 987 | 987 |
} |
| 988 | 988 |
|
| 989 | 989 |
while((dent = readdir(dd))) {
|
| 990 |
-#ifndef C_INTERIX |
|
| 991 | 990 |
if(dent->d_ino) |
| 992 |
-#endif |
|
| 993 | 991 |
{
|
| 994 | 992 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && |
| 995 | 993 |
(cli_strbcasestr(dent->d_name, ".db") || |
| ... | ... |
@@ -1469,9 +1467,7 @@ static int dircopy(const char *src, const char *dest) |
| 1469 | 1469 |
} |
| 1470 | 1470 |
|
| 1471 | 1471 |
while((dent = readdir(dd))) {
|
| 1472 |
-#if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) |
|
| 1473 | 1472 |
if(dent->d_ino) |
| 1474 |
-#endif |
|
| 1475 | 1473 |
{
|
| 1476 | 1474 |
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) |
| 1477 | 1475 |
continue; |
| ... | ... |
@@ -1617,9 +1613,7 @@ static int diffdirs(const char *old, const char *new, const char *patch) |
| 1617 | 1617 |
} |
| 1618 | 1618 |
|
| 1619 | 1619 |
while((dent = readdir(dd))) {
|
| 1620 |
-#ifndef C_INTERIX |
|
| 1621 | 1620 |
if(dent->d_ino) |
| 1622 |
-#endif |
|
| 1623 | 1621 |
{
|
| 1624 | 1622 |
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) |
| 1625 | 1623 |
continue; |
| ... | ... |
@@ -1645,9 +1639,7 @@ static int diffdirs(const char *old, const char *new, const char *patch) |
| 1645 | 1645 |
} |
| 1646 | 1646 |
|
| 1647 | 1647 |
while((dent = readdir(dd))) {
|
| 1648 |
-#ifndef C_INTERIX |
|
| 1649 | 1648 |
if(dent->d_ino) |
| 1650 |
-#endif |
|
| 1651 | 1649 |
{
|
| 1652 | 1650 |
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) |
| 1653 | 1651 |
continue; |