git-svn: trunk@2315
remotes/push_mirror/metadata
Tomasz Kojm 19 years ago
parent ea1b1dd38d
commit 3e499d06bc
  1. 4
      clamav-devel/ChangeLog
  2. 39
      clamav-devel/shared/misc.c

@ -1,3 +1,7 @@
Wed Sep 27 12:48:06 CEST 2006 (tk)
----------------------------------
* shared/misc.c: apply w32 patch from NJH
Wed Sep 27 12:20:38 CEST 2006 (tk) Wed Sep 27 12:20:38 CEST 2006 (tk)
---------------------------------- ----------------------------------
* freshclam/dns.c: apply w32 support patch from Mark Pizzolato * freshclam/dns.c: apply w32 support patch from Mark Pizzolato

@ -23,22 +23,30 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef C_WINDOWS
#include <dirent.h> #include <dirent.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include "clamav.h" #include "shared/cfgparser.h"
#include "cfgparser.h" #include "shared/memory.h"
#include "memory.h" #include "shared/output.h"
#include "output.h"
#include "../libclamav/cvd.h" #include "libclamav/clamav.h"
#include "libclamav/cvd.h"
#ifndef O_BINARY
#define O_BINARY 0
#endif
char *freshdbdir(void) char *freshdbdir(void)
@ -136,10 +144,10 @@ int filecopy(const char *src, const char *dest)
struct stat sb; struct stat sb;
if((s = open(src, O_RDONLY)) == -1) if((s = open(src, O_RDONLY|O_BINARY)) == -1)
return -1; return -1;
if((d = open(dest, O_CREAT|O_WRONLY|O_TRUNC)) == -1) { if((d = open(dest, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY)) == -1) {
close(s); close(s);
return -1; return -1;
} }
@ -177,13 +185,17 @@ int rmdirs(const char *dirname)
} }
while((dent = readdir(dd))) { while((dent = readdir(dd))) {
#if (!defined(C_CYGWIN)) && (!defined(C_INTERIX)) #if (!defined(C_CYGWIN)) && (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino) if(dent->d_ino)
#endif #endif
{ {
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) { if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char)); fname = mcalloc(strlen(dirname) + strlen(dent->d_name) + 2, sizeof(char));
#ifdef C_WINDOWS
sprintf(fname, "%s\\%s", dirname, dent->d_name);
#else
sprintf(fname, "%s/%s", dirname, dent->d_name); sprintf(fname, "%s/%s", dirname, dent->d_name);
#endif
/* stat the file */ /* stat the file */
if(lstat(fname, &statbuf) != -1) { if(lstat(fname, &statbuf) != -1) {
@ -237,7 +249,7 @@ int dircopy(const char *src, const char *dest)
} }
while((dent = readdir(dd))) { while((dent = readdir(dd))) {
#if (!defined(C_CYGWIN)) && (!defined(C_INTERIX)) #if (!defined(C_CYGWIN)) && (!defined(C_INTERIX)) && (!defined(C_WINDOWS))
if(dent->d_ino) if(dent->d_ino)
#endif #endif
{ {
@ -276,7 +288,7 @@ int cvd_unpack(const char *cvd, const char *destdir)
int fd; int fd;
if((fd = open(cvd, O_RDONLY)) == -1) if((fd = open(cvd, O_RDONLY|O_BINARY)) == -1)
return -1; return -1;
if(lseek(fd, 512, SEEK_SET) == -1) { if(lseek(fd, 512, SEEK_SET) == -1) {
@ -292,11 +304,12 @@ int cvd_unpack(const char *cvd, const char *destdir)
void daemonize(void) void daemonize(void)
{ {
int i; #if defined(C_OS2) || defined(C_WINDOWS)
fputs("Background mode is not supported on your operating system\n", stderr);
#ifdef C_OS2
return; return;
#else #else
int i;
if((i = open("/dev/null", O_WRONLY)) == -1) { if((i = open("/dev/null", O_WRONLY)) == -1) {
for(i = 0; i <= 2; i++) for(i = 0; i <= 2; i++)

Loading…
Cancel
Save