From cc8bc4bd6ed707793225f6c2ad04267541d95152 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Sat, 28 May 2005 11:37:27 +0000 Subject: [PATCH] logger() now handles Foreground mode git-svn: trunk@1592 --- clamav-devel/clamav-milter/clamav-milter.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/clamav-devel/clamav-milter/clamav-milter.c b/clamav-devel/clamav-milter/clamav-milter.c index 47ef32506..98e974796 100644 --- a/clamav-devel/clamav-milter/clamav-milter.c +++ b/clamav-devel/clamav-milter/clamav-milter.c @@ -22,7 +22,7 @@ * * For installation instructions see the file INSTALL that came with this file */ -static char const rcsid[] = "$Id: clamav-milter.c,v 1.207 2005/05/28 10:28:52 nigelhorne Exp $"; +static char const rcsid[] = "$Id: clamav-milter.c,v 1.208 2005/05/28 11:37:27 nigelhorne Exp $"; #define CM_VERSION "0.85e" @@ -1382,7 +1382,6 @@ main(int argc, char **argv) return EX_CANTCREAT; } } - logFile = strdup(logFile); } else { logFile = console; if(consolefd < 0) { @@ -5036,7 +5035,12 @@ logger(const char *mess) #ifdef CL_DEBUG puts(mess); #else - FILE *fout = fopen(logFile, "a"); + FILE *fout; + + if(cfgopt(copt, "Foreground")) + fout = stderr; + else + fout = fopen(logFile, "a"); if(fout == NULL) return; @@ -5058,6 +5062,7 @@ logger(const char *mess) #endif } else fprintf(fout, "%s\n", mess); - fclose(fout); + if(fout != stderr) + fclose(fout); #endif }