]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - dansguardian_report.c
Normalize the messages to have less messages to translate.
[thirdparty/sarg.git] / dansguardian_report.c
index 938820a925e72ad59cbe964f325f40ef886c9dab..74cf8d36cf21fbd5494d18d811eb03f3da66b271 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
- *                                                            1998, 2012
+ *                                                            1998, 2013
  *
  * SARG donations:
  *      please look at http://sarg.sourceforge.net/donations.php
@@ -62,19 +62,19 @@ void dansguardian_report(void)
        if(!dansguardian_count) {
                if (!KeepTempLog && unlink(dansguardian_in))
                        debuga(_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
-               if (debugz) debugaz(_("Dansguardian report not generated because it is empty\n"));
+               if (debugz>=LogLevel_Process) debugaz(_("Dansguardian report not generated because it is empty\n"));
                return;
        }
 
        sprintf(report,"%s/dansguardian.html",outdirname);
 
        if((fp_in=MY_FOPEN(dansguardian_in,"r"))==NULL) {
-               debuga(_("(dansguardian_report) Cannot open log file %s: %s\n"),dansguardian_in,strerror(errno));
+               debuga(_("Cannot open file \"%s\": %s\n"),dansguardian_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_FOPEN(report,"w"))==NULL) {
-               debuga(_("(dansguardian_report) Cannot open log file %s: %s\n"),report,strerror(errno));
+               debuga(_("Cannot open file \"%s\": %s\n"),report,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -107,7 +107,7 @@ void dansguardian_report(void)
                if(UserIp)
                        strcpy(user,ip);
 
-               bzero(date, 15);
+               memset(date,0,sizeof(date));
                if (df!='u') {
                        strncpy(date,date2+6,2);
                        strcat(date,"/");
@@ -167,8 +167,10 @@ void dansguardian_report(void)
        fputs("</table></div>\n",fp_ou);
        if (write_html_trailer(fp_ou)<0)
                debuga(_("Write error in file %s\n"),report);
-       if (fclose(fp_ou)==EOF)
-               debuga(_("Failed to close file %s - %s\n"),report,strerror(errno));
+       if (fclose(fp_ou)==EOF) {
+               debuga(_("Write error in \"%s\": %s\n"),report,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
 
        if (!KeepTempLog && unlink(dansguardian_in)) {
                debuga(_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));