/*
* SARG Squid Analysis Report Generator http://sarg.sourceforge.net
- * 1998, 2013
+ * 1998, 2015
*
* SARG donations:
* please look at http://sarg.sourceforge.net/donations.php
ip4allocated+=5;
temp=realloc(exclude_ip4,ip4allocated*sizeof(*temp));
if (temp==NULL) {
- debuga(_("Not enough memory to store the exlcluded IP addresses\n"));
+ debuga(__FILE__,__LINE__,_("Not enough memory to store the exlcluded IP addresses\n"));
exit(EXIT_FAILURE);
}
exclude_ip4=temp;
ip6allocated+=5;
temp=realloc(exclude_ip6,ip6allocated*sizeof(*temp));
if (temp==NULL) {
- debuga(_("Not enough memory to store the exlcluded IP addresses\n"));
+ debuga(__FILE__,__LINE__,_("Not enough memory to store the exlcluded IP addresses\n"));
exit(EXIT_FAILURE);
}
exclude_ip6=temp;
nameallocated+=5;
temp=realloc(exclude_name,nameallocated*sizeof(*temp));
if (temp==NULL) {
- debuga(_("Not enough memory to store the excluded URLs\n"));
+ debuga(__FILE__,__LINE__,_("Not enough memory to store the excluded URLs\n"));
exit(EXIT_FAILURE);
}
exclude_name=temp;
num_exclude_name++;
item->url=malloc(length+1);
if (!item->url) {
- debuga(_("Not enough memory to store the excluded URLs\n"));
+ debuga(__FILE__,__LINE__,_("Not enough memory to store the excluded URLs\n"));
exit(EXIT_FAILURE);
}
safe_strcpy(item->url,url,length+1);
const char *next;
if(access(hexfile, R_OK) != 0) {
- debuga(_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
exit(EXIT_FAILURE);
}
if(debug)
- debuga(_("Loading exclude host file from: %s\n"),hexfile);
+ debuga(__FILE__,__LINE__,_("Loading exclude host file from \"%s\"\n"),hexfile);
if ((fp_ex = fopen(hexfile, "r")) == NULL) {
- debuga(_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
exit(EXIT_FAILURE);
}
type=extract_address_mask(buf,&name,ipv4,ipv6,&nbits,&next);
if (type<0) {
- debuga(_("While reading \"%s\"\n"),hexfile);
+ debuga(__FILE__,__LINE__,_("While reading \"%s\"\n"),hexfile);
exit(EXIT_FAILURE);
}
}
}
- fclose(fp_ex);
+ if (fclose(fp_ex)==EOF) {
+ debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),hexfile,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
return;
}
long int nreg=0;
if(debug)
- debuga(_("Loading exclude file from: %s\n"),uexfile);
+ debuga(__FILE__,__LINE__,_("Loading exclude file from \"%s\"\n"),uexfile);
if ((fp_ex = fopen(uexfile, "r")) == NULL) {
- debuga(_("Cannot open file \"%s\": %s\n"),uexfile,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),uexfile,strerror(errno));
exit(EXIT_FAILURE);
}
if (fseek(fp_ex, 0, SEEK_END)==-1) {
- debuga(_("Failed to move till the end of the excluded users file %s: %s\n"),uexfile,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Failed to move till the end of file \"%s\": %s\n"),uexfile,strerror(errno));
exit(EXIT_FAILURE);
}
nreg = ftell(fp_ex);
if (nreg<0) {
- debuga(_("Cannot get the size of file %s\n"),uexfile);
+ debuga(__FILE__,__LINE__,_("Cannot get the size of file \"%s\"\n"),uexfile);
exit(EXIT_FAILURE);
}
nreg += 11;
if (fseek(fp_ex, 0, SEEK_SET)==-1) {
- debuga(_("Failed to rewind the excluded users file %s: %s\n"),uexfile,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Failed to rewind file \"%s\": %s\n"),uexfile,strerror(errno));
exit(EXIT_FAILURE);
}
if((excludeuser=(char *) malloc(nreg))==NULL){
- debuga(_("malloc error (%ld bytes required)\n"),nreg);
+ debuga(__FILE__,__LINE__,_("malloc error (%ld bytes required)\n"),nreg);
exit(EXIT_FAILURE);
}
strcat(excludeuser,"*END* ");
- fclose(fp_ex);
+ if (fclose(fp_ex)==EOF) {
+ debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),uexfile,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
return;
}