c4w: make freshclamwrap stfu if verbose_off is present

remotes/push_mirror/multihash
aCaB 15 years ago
parent eefbe50d6b
commit 69e6d4bc54
  1. 15
      win32/clamav-for-windows/freshclamwrap/flog.c
  2. 4
      win32/clamav-for-windows/freshclamwrap/freshclamwrap.c

@ -19,14 +19,20 @@
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include "flog.h"
static HANDLE logh = INVALID_HANDLE_VALUE;
static int log_dbg = 0;
void flog_open(const char *path) {
char logfile[4096];
DWORD sz;
logh = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
_snprintf(logfile, sizeof(logfile), "%s\\update.log", path);
logfile[sizeof(logfile)-1] = '\0';
logh = CreateFile(logfile, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(logh == INVALID_HANDLE_VALUE)
return;
sz = GetFileSize(logh, NULL);
@ -34,6 +40,11 @@ void flog_open(const char *path) {
SetEndOfFile(logh);
else
SetFilePointer(logh, 0, NULL, FILE_END);
_snprintf(logfile, sizeof(logfile), "%s\\update_log_verbose_off", path);
logfile[sizeof(logfile)-1] = '\0';
if(access(logfile, 0) == -1)
log_dbg = 1;
flog("Log file initialized");
}
@ -69,7 +80,7 @@ void flog_dbg(const char *fmt, ...) {
va_list ap;
int len;
if(logh == INVALID_HANDLE_VALUE)
if(!log_dbg)
return;
GetLocalTime(&t);

@ -250,9 +250,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
*ptr = '\0';
/* Log file */
_snprintf(command, sizeof(command)-1, "%s\\update.log", datadir);
command[sizeof(command)-1] = '\0';
flog_open(command);
flog_open(datadir);
_snprintf(command, sizeof(command)-1, "freshclam.exe --stdout --config-file=\"%s\\freshclam.conf\" --datadir=\"%s\"", datadir, datadir);
command[sizeof(command)-1] = '\0';

Loading…
Cancel
Save