git-svn: trunk@2875
Tomasz Kojm authored on 2007/02/28 12:12:51... | ... |
@@ -41,7 +41,9 @@ |
41 | 41 |
|
42 | 42 |
#include <stdio.h> |
43 | 43 |
|
44 |
+#ifndef C_WINDOWS |
|
44 | 45 |
int strncmp(const char *s1, const char *s2, size_t n); |
46 |
+#endif |
|
45 | 47 |
|
46 | 48 |
/* Comment out all this code if we are using the GNU C Library, and are not |
47 | 49 |
actually compiling the library itself. This code is part of the GNU C |
... | ... |
@@ -21,8 +21,13 @@ |
21 | 21 |
#ifndef __NETWORK_H |
22 | 22 |
#define __NETWORK_H |
23 | 23 |
|
24 |
+#ifdef HAVE_SYS_TYPES_H |
|
24 | 25 |
#include <sys/types.h> |
26 |
+#endif |
|
27 |
+ |
|
28 |
+#ifndef C_WINDOWS |
|
25 | 29 |
#include <netdb.h> |
30 |
+#endif |
|
26 | 31 |
|
27 | 32 |
int r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t len); |
28 | 33 |
|
... | ... |
@@ -16,6 +16,11 @@ |
16 | 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | 17 |
* MA 02110-1301, USA. |
18 | 18 |
*/ |
19 |
+#ifdef _MSC_VER |
|
20 |
+#include <windows.h> |
|
21 |
+#include <winsock.h> |
|
22 |
+#endif |
|
23 |
+ |
|
19 | 24 |
|
20 | 25 |
#if HAVE_CONFIG_H |
21 | 26 |
#include "clamav-config.h" |
... | ... |
@@ -26,13 +31,17 @@ |
26 | 26 |
#include <stdlib.h> |
27 | 27 |
#include <string.h> |
28 | 28 |
#include <ctype.h> |
29 |
+#ifdef HAVE_UNISTD_H |
|
29 | 30 |
#include <unistd.h> |
31 |
+#endif |
|
30 | 32 |
#include <fcntl.h> |
31 | 33 |
#include <time.h> |
32 | 34 |
#include <sys/stat.h> |
33 | 35 |
#include <errno.h> |
36 |
+#ifndef C_WINDOWS |
|
34 | 37 |
#include <sys/time.h> |
35 | 38 |
#include <sys/socket.h> |
39 |
+#endif |
|
36 | 40 |
#if HAVE_SYS_TYPES_H |
37 | 41 |
#include <sys/types.h> |
38 | 42 |
#endif |
... | ... |
@@ -121,7 +130,9 @@ void logg_close(void) { |
121 | 121 |
int logg(const char *str, ...) |
122 | 122 |
{ |
123 | 123 |
va_list args, argscpy, argsout; |
124 |
+#ifdef F_WRLCK |
|
124 | 125 |
struct flock fl; |
126 |
+#endif |
|
125 | 127 |
char *pt, *timestr, vbuff[1025]; |
126 | 128 |
time_t currtime; |
127 | 129 |
struct stat sb; |
... | ... |
@@ -139,7 +150,7 @@ int logg(const char *str, ...) |
139 | 139 |
if(logg_file) { |
140 | 140 |
if(!logg_fd) { |
141 | 141 |
old_umask = umask(0037); |
142 |
- if((logg_fd = fopen(logg_file, "a")) == NULL) { |
|
142 |
+ if((logg_fd = fopen(logg_file, "at")) == NULL) { |
|
143 | 143 |
umask(old_umask); |
144 | 144 |
#ifdef CL_THREAD_SAFE |
145 | 145 |
pthread_mutex_unlock(&logg_mutex); |
... | ... |
@@ -148,6 +159,7 @@ int logg(const char *str, ...) |
148 | 148 |
return -1; |
149 | 149 |
} else umask(old_umask); |
150 | 150 |
|
151 |
+#ifdef F_WRLCK |
|
151 | 152 |
if(logg_lock) { |
152 | 153 |
memset(&fl, 0, sizeof(fl)); |
153 | 154 |
fl.l_type = F_WRLCK; |
... | ... |
@@ -158,6 +170,7 @@ int logg(const char *str, ...) |
158 | 158 |
return -1; |
159 | 159 |
} |
160 | 160 |
} |
161 |
+#endif |
|
161 | 162 |
} |
162 | 163 |
|
163 | 164 |
if(logg_size) { |