Browse code

merge win32 patches from NJH

git-svn: trunk@2819

Tomasz Kojm authored on 2007/02/21 01:58:46
Showing 4 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Feb 20 15:59:12 CET 2007 (tk)
2
+---------------------------------
3
+  * clamd, clamconf: merge win32 patches from NJH
4
+
1 5
 Tue Feb 20 11:53:47 GMT 2007 (trog)
2 6
 -----------------------------------
3 7
   * libclamav/unrar: allow for sparc aligned access requirements (bb#304)
... ...
@@ -26,7 +26,9 @@
26 26
 #include <string.h>
27 27
 #include <sys/types.h>
28 28
 #include <sys/stat.h>
29
+#ifdef HAVE_UNISTD_H
29 30
 #include <unistd.h>
31
+#endif
30 32
 
31 33
 #include "cfgparser.h"
32 34
 #define _GNU_SOURCE
... ...
@@ -24,9 +24,13 @@
24 24
 #include <stdio.h>
25 25
 #include <string.h>
26 26
 #include <sys/types.h>
27
+#ifndef	C_WINDOWS
27 28
 #include <sys/socket.h>
29
+#endif
28 30
 #include <sys/stat.h>
31
+#ifndef	C_WINDOWS
29 32
 #include <sys/un.h>
33
+#endif
30 34
 #include <errno.h>
31 35
 #ifdef HAVE_UNISTD_H
32 36
 #include <unistd.h>
... ...
@@ -42,7 +46,7 @@
42 42
 #include "output.h"
43 43
 #include "localserver.h"
44 44
 
45
-#ifdef        C_WINDOWS
45
+#ifdef C_WINDOWS
46 46
 int localserver(const struct cfgstruct *copt)
47 47
 {
48 48
     logg("!Localserver is not supported on this platform");
... ...
@@ -516,7 +516,9 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_engine *engine, unsigne
516 516
     time(&start_time);
517 517
 
518 518
     for(;;) {				
519
-	struct stat st_buf;
519
+#if !defined(C_WINDOWS) && !defined(C_BEOS)
520
+	    struct stat st_buf;
521
+#endif
520 522
     	int socketd = socketds[0];
521 523
     	if(nsockets > 1) {
522 524
     	    int pollret = poll_fds(socketds, nsockets, -1);
... ...
@@ -525,7 +527,8 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_engine *engine, unsigne
525 525
     	    } else {
526 526
     		socketd = socketds[0]; /* on a poll error use the first socket */
527 527
     	    }
528
-    	}    
528
+    	}
529
+#if !defined(C_WINDOWS) && !defined(C_BEOS)
529 530
 	if(fstat(socketd, &st_buf) == -1) {
530 531
 	    logg("!fstat(): socket descriptor gone\n");
531 532
 	    memmove(socketds, socketds + 1, sizeof(socketds[0]) * nsockets);
... ...
@@ -535,6 +538,7 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_engine *engine, unsigne
535 535
 		break;
536 536
 	    }
537 537
 	}
538
+#endif
538 539
 	new_sd = accept(socketd, NULL, NULL);
539 540
 	if((new_sd == -1) && (errno != EINTR)) {
540 541
 	    if(progexit) {