]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Don't reopen the denied.log and authfail.log when parsing a new access.log file as...
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 7 Sep 2009 13:13:51 +0000 (13:13 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 7 Sep 2009 13:13:51 +0000 (13:13 +0000)
log.c

diff --git a/log.c b/log.c
index 1d489dc648fd76c8b0a3ad99643ca4038f6fed97..3092133be048b8828a2b7dfbc54c7a388c850747 100644 (file)
--- a/log.c
+++ b/log.c
@@ -677,6 +677,22 @@ int main(int argc,char *argv[])
    sprintf ( sz_Download_Unsort , "%s/sarg/download.unsort", tmp);
    bool_ShowReadStatistics = ( strcmp(ShowReadStatistics,"yes") == 0 ) ;
 
+   if(strstr(ReportType,"denied") != 0) {
+      if((fp_denied=MY_FOPEN(tmp4,"w"))==NULL) {
+         fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[45],tmp4,strerror(errno));
+         exit(1);
+      }
+   }
+
+   if(DataFile[0]=='\0') {
+      if(strstr(ReportType,"denied") != 0 || strstr(ReportType,"auth_failures") != 0) {
+         if((fp_authfail=MY_FOPEN(tmp6,"w"))==NULL) {
+            fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[45],tmp6,strerror(errno));
+            exit(1);
+         }
+      }
+   }
+
    while(narq--) {
       strcpy(arq,warq[iarq]);
       iarq++;
@@ -716,22 +732,6 @@ int main(int argc,char *argv[])
          fputs("*** SARG Log ***\n",fp_log);
       }
 
-      if(strstr(ReportType,"denied") != 0) {
-         if((fp_denied=MY_FOPEN(tmp4,"w"))==NULL) {
-            fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[45],tmp4,strerror(errno));
-            exit(1);
-         }
-      }
-
-      if(DataFile[0]=='\0') {
-         if(strstr(ReportType,"denied") != 0 || strstr(ReportType,"auth_failures") != 0) {
-            if((fp_authfail=MY_FOPEN(tmp6,"w"))==NULL) {
-               fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[45],tmp6,strerror(errno));
-               exit(1);
-            }
-         }
-      }
-
       // pre-Read the file only if I have to show stats
       if(bool_ShowReadStatistics) {
          rewind(fp_in);