]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - squidguard_report.c
Give a try to splint and apply a few of the recommandations
[thirdparty/sarg.git] / squidguard_report.c
index e62c630034cefd0ac27a4765ba0661c076b45cc5..28de27d09153712c7679c4c0bbbef4f4d490fd73 100644 (file)
@@ -32,6 +32,7 @@ void squidguard_report(void)
 
    FILE *fp_in = NULL, *fp_ou = NULL;
 
+   char buf[MAXLEN];
    char *url;
    char squidguard_in[MAXLEN];
    char per[MAXLEN];
@@ -45,6 +46,7 @@ void squidguard_report(void)
    char data[15];
    char data2[15];
    char hora[15];
+   char ouser2[255];
    int  z=0;
    int  count=0;
    struct getwordstruct gwarea;
@@ -62,23 +64,23 @@ void squidguard_report(void)
 
    if ((fp_in = fopen(per, "r")) == 0) {
       debuga(_("(squidguard) Cannot open file %s\n"),per);
-      exit(1);
+      exit(EXIT_FAILURE);
    }
 
    if (!fgets(period,sizeof(period),fp_in)) {
       debuga(_("(squidguard) read error in %s\n"),per);
-      exit(1);
+      exit(EXIT_FAILURE);
    }
    fclose(fp_in);
 
    if((fp_in=fopen(squidguard_in,"r"))==NULL) {
      debuga(_("(squidguard) Cannot open log file %s\n"),squidguard_in);
-     exit(1);
+     exit(EXIT_FAILURE);
    }
 
    if((fp_ou=fopen(report,"w"))==NULL) {
      debuga(_("(squidguard) Cannot open log file %s\n"),report);
-     exit(1);
+     exit(EXIT_FAILURE);
    }
 
    write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("SQUIDGUARD"));
@@ -95,15 +97,15 @@ void squidguard_report(void)
       if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(data2,sizeof(data2),&gwarea,'\t')<0 ||
           getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
          debuga(_("There is a broken record or garbage in file %s\n"),squidguard_in);
-         exit(1);
+         exit(EXIT_FAILURE);
       }
       if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
          debuga(_("There is a broken url in file %s\n"),squidguard_in);
-         exit(1);
+         exit(EXIT_FAILURE);
       }
       if (getword(rule,sizeof(rule),&gwarea,'\n')<0) {
          debuga(_("There is a broken rule in file %s\n"),squidguard_in);
-         exit(1);
+         exit(EXIT_FAILURE);
       }
 
       if(UserIp)