diff --git a/ChangeLog b/ChangeLog index e90f93340..0b4446e09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Feb 28 02:17:39 CET 2007 (tk) +--------------------------------- + * shared: merge win32 patches from NJH + Wed Feb 28 01:48:27 CET 2007 (tk) --------------------------------- * drop shared/memory.[ch] diff --git a/shared/cdiff.c b/shared/cdiff.c index 8dba2618f..8fe8ea3dd 100644 --- a/shared/cdiff.c +++ b/shared/cdiff.c @@ -27,7 +27,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include "shared/misc.h" #include "shared/output.h" diff --git a/shared/getopt.c b/shared/getopt.c index 9350ad357..41307553b 100644 --- a/shared/getopt.c +++ b/shared/getopt.c @@ -41,7 +41,9 @@ #include +#ifndef C_WINDOWS int strncmp(const char *s1, const char *s2, size_t n); +#endif /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C diff --git a/shared/network.c b/shared/network.c index 98beecf36..8ac3a622b 100644 --- a/shared/network.c +++ b/shared/network.c @@ -33,11 +33,11 @@ #include #endif -#ifdef HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H #include #endif -#ifndef C_WINDOWS +#ifndef C_WINDOWS #include #endif diff --git a/shared/network.h b/shared/network.h index b72ebcb6b..6c33617fe 100644 --- a/shared/network.h +++ b/shared/network.h @@ -21,8 +21,13 @@ #ifndef __NETWORK_H #define __NETWORK_H +#ifdef HAVE_SYS_TYPES_H #include +#endif + +#ifndef C_WINDOWS #include +#endif int r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t len); diff --git a/shared/output.c b/shared/output.c index eeee084c5..e3e0c464a 100644 --- a/shared/output.c +++ b/shared/output.c @@ -16,6 +16,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ +#ifdef _MSC_VER +#include +#include +#endif + #if HAVE_CONFIG_H #include "clamav-config.h" @@ -26,13 +31,17 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include #include #include +#ifndef C_WINDOWS #include #include +#endif #if HAVE_SYS_TYPES_H #include #endif @@ -121,7 +130,9 @@ void logg_close(void) { int logg(const char *str, ...) { va_list args, argscpy, argsout; +#ifdef F_WRLCK struct flock fl; +#endif char *pt, *timestr, vbuff[1025]; time_t currtime; struct stat sb; @@ -139,7 +150,7 @@ int logg(const char *str, ...) if(logg_file) { if(!logg_fd) { old_umask = umask(0037); - if((logg_fd = fopen(logg_file, "a")) == NULL) { + if((logg_fd = fopen(logg_file, "at")) == NULL) { umask(old_umask); #ifdef CL_THREAD_SAFE pthread_mutex_unlock(&logg_mutex); @@ -148,6 +159,7 @@ int logg(const char *str, ...) return -1; } else umask(old_umask); +#ifdef F_WRLCK if(logg_lock) { memset(&fl, 0, sizeof(fl)); fl.l_type = F_WRLCK; @@ -158,6 +170,7 @@ int logg(const char *str, ...) return -1; } } +#endif } if(logg_size) {