]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - topuser.c
Merge messages about IP addresses.
[thirdparty/sarg.git] / topuser.c
index 59fb9a84d50127d9f7c01be2aa9834b9b179c981..47662cc3d741febf1b34a0cf37400cccc4229830 100644 (file)
--- a/topuser.c
+++ b/topuser.c
@@ -1,6 +1,6 @@
 /*
  * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
- *                                                            1998, 2013
+ *                                                            1998, 2015
  *
  * SARG donations:
  *      please look at http://sarg.sourceforge.net/donations.php
@@ -140,7 +140,10 @@ void topuser(void)
                tnincache+=item.incache;
                tnoucache+=item.oucache;
        }
-       fclose(fp_in);
+       if (fclose(fp_in)==EOF) {
+               debuga(_("Read error in \"%s\": %s\n"),wger,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
        longline_destroy(&line);
 
        if (olduser[0] != '\0') {
@@ -313,27 +316,27 @@ void topuser(void)
        while((warea=longline_read(fp_top1,line))!=NULL) {
                getword_start(&gwarea,warea);
                if (getword(user,sizeof(user),&gwarea,'\t')<0) {
-                       debuga(_("There is a broken user in file %s\n"),top1);
+                       debuga(_("Invalid user in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&nbytes,&gwarea,'\t')<0) {
-                       debuga(_("There is a broken number of bytes in file %s\n"),top1);
+                       debuga(_("Invalid number of bytes in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&nacc,&gwarea,'\t')<0) {
-                       debuga(_("There is a broken number of access in file %s\n"),top1);
+                       debuga(_("Invalid number of accesses in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&elap,&gwarea,'\t')<0) {
-                       debuga(_("There is a broken elpased time in file %s\n"),top1);
+                       debuga(_("Invalid elapsed time in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&incac,&gwarea,'\t')<0) {
-                       debuga(_("There is a broken in-cache size in file %s\n"),top1);
+                       debuga(_("Invalid in-cache size in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&oucac,&gwarea,'\n')<0) {
-                       debuga(_("There is a broken out-of-cache size in file %s\n"),top1);
+                       debuga(_("Invalid out-of-cache size in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if(nacc < 1)
@@ -345,7 +348,7 @@ void topuser(void)
 
                uinfo=userinfo_find_from_id(user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file %s\n"),user,top1);
+                       debuga(_("Unknown user ID %s in file \"%s\"\n"),user,top1);
                        exit(EXIT_FAILURE);
                }
                uinfo->topuser=1;
@@ -423,7 +426,10 @@ void topuser(void)
 
                topcount++;
        }
-       fclose(fp_top1);
+       if (fclose(fp_top1)==EOF) {
+               debuga(_("Read error in \"%s\": %s\n"),top1,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
        if (!KeepTempLog && unlink(top1)) {
                debuga(_("Cannot delete \"%s\": %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);