From: Frédéric Marchal Date: Thu, 6 Sep 2012 18:09:15 +0000 (+0200) Subject: Explain the reason when a file cannot be opened X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d6f0349d3dc994a07fdc514433032f88e24c4588;p=thirdparty%2Fsarg.git Explain the reason when a file cannot be opened The system error string is written in the error message when a file cannot be opened. It should help in diagnosing the reason for a failure. --- diff --git a/auth.c b/auth.c index 36c22b1..9d2d03f 100644 --- a/auth.c +++ b/auth.c @@ -43,12 +43,12 @@ void htaccess(const struct userinfostruct *uinfo) exit(EXIT_FAILURE); } if((fp_auth=fopen(htname,"w"))==NULL) { - debuga(_("(auth) Cannot open file: %s - %s\n"),htname,strerror(errno)); + debuga(_("(auth) Cannot open file %s: %s\n"),htname,strerror(errno)); exit(EXIT_FAILURE); } if ((fp_in=fopen(AuthUserTemplateFile,"r"))==NULL) { - debuga(_("(auth) Cannot open template file: %s - %s\n"),AuthUserTemplateFile,strerror(errno)); + debuga(_("(auth) Cannot open template file %s: %s\n"),AuthUserTemplateFile,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/authfail.c b/authfail.c index dd15e69..e10593f 100644 --- a/authfail.c +++ b/authfail.c @@ -53,7 +53,7 @@ void authfail_open(void) snprintf(authfail_unsort,sizeof(authfail_unsort),"%s/authfail.int_unsort",tmp); if ((fp_authfail=MY_FOPEN(authfail_unsort,"w"))==NULL) { - debuga(_("(log) Cannot open file: %s - %s\n"),authfail_unsort,strerror(errno)); + debuga(_("(log) Cannot open file %s: %s\n"),authfail_unsort,strerror(errno)); exit(EXIT_FAILURE); } return; @@ -157,7 +157,7 @@ void authfail_report(void) exit(EXIT_FAILURE); } if((fp_in=MY_FOPEN(authfail_sort,"r"))==NULL) { - debuga(_("(authfail) Cannot open file %s\n"),authfail_sort); + debuga(_("(authfail) Cannot open file %s: %s\n"),authfail_sort,strerror(errno)); debuga(_("sort command: %s\n"),csort); exit(EXIT_FAILURE); } @@ -168,7 +168,7 @@ void authfail_report(void) authfail_unsort[0]='\0'; if((fp_ou=MY_FOPEN(report,"w"))==NULL) { - debuga(_("(authfail) Cannot open file %s\n"),report); + debuga(_("(authfail) Cannot open file %s: %s\n"),report,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/convlog.c b/convlog.c index df3dfdc..df75639 100644 --- a/convlog.c +++ b/convlog.c @@ -43,7 +43,7 @@ void convlog(const char *arq, char df, int dfrom, int duntil) arq="/var/log/squid/access.log"; if((fp_in=MY_FOPEN(arq,"r"))==NULL) { - debuga(_("(convlog) Cannot open log file %s - %s\n"),arq,strerror(errno)); + debuga(_("(convlog) Cannot open log file %s: %s\n"),arq,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/dansguardian_log.c b/dansguardian_log.c index 69e37b6..3701a79 100644 --- a/dansguardian_log.c +++ b/dansguardian_log.c @@ -58,12 +58,12 @@ void dansguardian_log(void) } if((fp_guard=fopen(DansGuardianConf,"r"))==NULL) { - debuga(_("(dansguardian) Cannot open log file: %s\n"),DansGuardianConf); + debuga(_("(dansguardian) Cannot open log file %s: %s\n"),DansGuardianConf,strerror(errno)); exit(EXIT_FAILURE); } if((fp_ou=MY_FOPEN(guard_in,"a"))==NULL) { - debuga(_("(dansguardian) Cannot open log file: %s\n"),guard_in); + debuga(_("(dansguardian) Cannot open log file %s: %s\n"),guard_in,strerror(errno)); exit(EXIT_FAILURE); } @@ -87,7 +87,7 @@ void dansguardian_log(void) debuga(_("Reading DansGuardian log file: %s\n"),loglocation); if((fp_in=MY_FOPEN(loglocation,"r"))==NULL) { - debuga(_("(dansguardian) Cannot open log file: %s\n"),loglocation); + debuga(_("(dansguardian) Cannot open log file %s: %s\n"),loglocation,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/dansguardian_report.c b/dansguardian_report.c index c3fd140..938820a 100644 --- a/dansguardian_report.c +++ b/dansguardian_report.c @@ -69,12 +69,12 @@ void dansguardian_report(void) sprintf(report,"%s/dansguardian.html",outdirname); if((fp_in=MY_FOPEN(dansguardian_in,"r"))==NULL) { - debuga(_("(dansguardian_report) Cannot open log file %s\n"),dansguardian_in); + debuga(_("(dansguardian_report) Cannot open log 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\n"),report); + debuga(_("(dansguardian_report) Cannot open log file %s: %s\n"),report,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/datafile.c b/datafile.c index 33c80d1..b6e3998 100644 --- a/datafile.c +++ b/datafile.c @@ -89,7 +89,7 @@ void data_file(char *tmp) } if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){ - debuga(_("(datafile) Cannot open file %s\n"),tmp3); + debuga(_("(datafile) Cannot open file %s: %s\n"),tmp3,strerror(errno)); exit(EXIT_FAILURE); } @@ -145,7 +145,7 @@ void data_file(char *tmp) if(!same_url || new_user){ if(!fp_ou && (fp_ou=MY_FOPEN(DataFile,"w"))==NULL){ - debuga(_("(datafile) Cannot open file %s\n"),DataFile); + debuga(_("(datafile) Cannot open file %s: %s\n"),DataFile,strerror(errno)); exit(EXIT_FAILURE); } saverecs(fp_ou,uinfo,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache); diff --git a/denied.c b/denied.c index b09c41b..1eda2e9 100644 --- a/denied.c +++ b/denied.c @@ -53,7 +53,7 @@ void denied_open(void) snprintf(denied_unsort,sizeof(denied_unsort),"%s/denied.int_unsort",tmp); if ((fp_denied=MY_FOPEN(denied_unsort,"w"))==NULL) { - debuga(_("(log) Cannot open file: %s - %s\n"),denied_unsort,strerror(errno)); + debuga(_("(log) Cannot open file %s: %s\n"),denied_unsort,strerror(errno)); exit(EXIT_FAILURE); } return; @@ -170,12 +170,12 @@ void gen_denied_report(void) sprintf(report,"%s/denied.html",outdirname); if((fp_in=MY_FOPEN(denied_sort,"r"))==NULL) { - debuga(_("(denied) Cannot open log file %s\n"),denied_sort); + debuga(_("(denied) Cannot open log file %s: %s\n"),denied_sort,strerror(errno)); exit(EXIT_FAILURE); } if((fp_ou=MY_FOPEN(report,"w"))==NULL) { - debuga(_("(denied) Cannot open log file %s\n"),report); + debuga(_("(denied) Cannot open log file %s: %s\n"),report,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/download.c b/download.c index 37b4065..6028ecf 100644 --- a/download.c +++ b/download.c @@ -70,7 +70,7 @@ void download_open(void) snprintf(download_unsort,sizeof(download_unsort),"%s/download.int_unsort",tmp); if ((fp_download=MY_FOPEN(download_unsort,"w"))==NULL) { - debuga(_("(log) Cannot open file: %s - %s\n"),download_unsort,strerror(errno)); + debuga(_("(log) Cannot open file %s: %s\n"),download_unsort,strerror(errno)); exit(EXIT_FAILURE); } return; @@ -203,12 +203,12 @@ void download_report(void) snprintf(report,sizeof(report),"%s/download.html",outdirname); if((fp_in=MY_FOPEN(report_in,"r"))==NULL) { - debuga(_("(download) Cannot open log file %s\n"),report_in); + debuga(_("(download) Cannot open log file %s: %s\n"),report_in,strerror(errno)); exit(EXIT_FAILURE); } if((fp_ou=MY_FOPEN(report,"w"))==NULL) { - debuga(_("(download) Cannot open log file %s\n"),report); + debuga(_("(download) Cannot open log file %s: %s\n"),report,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/email.c b/email.c index 7a274bc..84a6d6c 100644 --- a/email.c +++ b/email.c @@ -58,19 +58,19 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema snprintf(wger,sizeof(wger),"%s/sarg-general",dirname); if((fp_in=fopen(wger,"r"))==NULL) { - debuga(_("(email) Cannot open file %s\n"),wger); + debuga(_("(email) Cannot open file %s: %s\n"),wger,strerror(errno)); exit(EXIT_FAILURE); } snprintf(top1,sizeof(top1),"%s/top",dirname); if((fp_top1=fopen(top1,"w"))==NULL) { - debuga(_("(email) Cannot open file %s\n"),top1); + debuga(_("(email) Cannot open file %s: %s\n"),top1,strerror(errno)); exit(EXIT_FAILURE); } snprintf(top2,sizeof(top2),"%s/top.tmp",dirname); if((fp_top2=fopen(top2,"w"))==NULL) { - debuga(_("(email) Cannot open file %s\n"),top2); + debuga(_("(email) Cannot open file %s: %s\n"),top2,strerror(errno)); exit(EXIT_FAILURE); } @@ -148,13 +148,13 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema } if((fp_top1=fopen(top1,"r"))==NULL) { - debuga(_("(email) Cannot open file %s\n"),top1); + debuga(_("(email) Cannot open file %s: %s\n"),top1,strerror(errno)); exit(EXIT_FAILURE); } snprintf(top3,sizeof(top3),"%s/report",dirname); if((fp_top3=fopen(top3,"w"))==NULL) { - debuga(_("(email) Cannot open file %s\n"),top3); + debuga(_("(email) Cannot open file %s: %s\n"),top3,strerror(errno)); exit(EXIT_FAILURE); } @@ -266,7 +266,7 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema if(strcmp(email,"stdout") == 0) { if((fp_top3=fopen(top3,"r"))==NULL) { - debuga(_("(email) Cannot open file %s\n"),top3); + debuga(_("(email) Cannot open file %s: %s\n"),top3,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/exclude.c b/exclude.c index 0c01054..ca479ab 100644 --- a/exclude.c +++ b/exclude.c @@ -200,7 +200,7 @@ void gethexclude(const char *hexfile, int debug) debuga(_("Loading exclude host file from: %s\n"),hexfile); if ((fp_ex = fopen(hexfile, "r")) == NULL) { - debuga(_("(gethexclude) Cannot open file %s - %s\n"),hexfile,strerror(errno)); + debuga(_("(gethexclude) Cannot open file %s: %s\n"),hexfile,strerror(errno)); exit(EXIT_FAILURE); } @@ -314,7 +314,7 @@ void getuexclude(const char *uexfile, int debug) debuga(_("Loading exclude file from: %s\n"),uexfile); if ((fp_ex = fopen(uexfile, "r")) == NULL) { - debuga(_("(gethexclude) Cannot open file %s - %s\n"),uexfile,strerror(errno)); + debuga(_("(gethexclude) Cannot open file %s: %s\n"),uexfile,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/grepday.c b/grepday.c index 5dd097d..48ea142 100644 --- a/grepday.c +++ b/grepday.c @@ -618,7 +618,7 @@ static void greport_plot(const struct userinfostruct *uinfo,struct PlotStruct *p exit(EXIT_FAILURE); } if((pngout=fopen(graph,"wb"))==NULL) { - debuga(_("(grepday) Cannot open log file %s\n"),graph); + debuga(_("(grepday) Cannot open log file %s: %s\n"),graph,strerror(errno)); exit(EXIT_FAILURE); } gdImagePng(gdata.im, pngout); @@ -689,7 +689,7 @@ void greport_day(const struct userinfostruct *uinfo) } if((fp_in=fopen(wdirname,"r"))==NULL) { - debuga(_("(grepday) Cannot open log file %s\n"),wdirname); + debuga(_("(grepday) Cannot open log file %s: %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); } @@ -735,7 +735,7 @@ void greport_day(const struct userinfostruct *uinfo) exit(EXIT_FAILURE); } if ((fp_ou=fopen(wdirname,"wt"))==NULL) { - debuga(_("(grepday) Cannot open output file %s\n"),wdirname); + debuga(_("(grepday) Cannot open output file %s: %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); } write_html_head(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 4 : 2,_("Graph report"),HTML_JS_NONE); diff --git a/html.c b/html.c index 751fdbc..5545117 100644 --- a/html.c +++ b/html.c @@ -107,7 +107,7 @@ void htmlrel(void) } if ((fp_in = fopen(arqin, "r")) == 0){ if (uinfo->no_report) continue; - debuga(_("(html3) Cannot open file %s\n"),arqin); + debuga(_("(html3) Cannot open file %s: %s\n"),arqin,strerror(errno)); exit(EXIT_FAILURE); } @@ -174,7 +174,7 @@ void htmlrel(void) rewind(fp_in); if ((fp_ou = fopen(arqou, "w")) == 0){ - debuga(_("(html5) Cannot open file %s\n"),arqou); + debuga(_("(html5) Cannot open file %s: %s\n"),arqou,strerror(errno)); exit(EXIT_FAILURE); } @@ -337,12 +337,12 @@ void htmlrel(void) } if ((fp_ip = fopen(arqip, "r")) == 0){ - debuga(_("(html6) Cannot open file %s\n"),arqip); + debuga(_("(html6) Cannot open file %s: %s\n"),arqip,strerror(errno)); exit(EXIT_FAILURE); } if ((fp_ip2 = MY_FOPEN(tmp2, "a")) == 0){ - debuga(_("(html7) Cannot open file %s\n"),tmp2); + debuga(_("(html7) Cannot open file %s: %s\n"),tmp2,strerror(errno)); exit(EXIT_FAILURE); } @@ -396,7 +396,7 @@ void htmlrel(void) } if ((fp_ip = MY_FOPEN(tmp3, "r")) == 0) { - debuga(_("(html8) Cannot open file %s\n"),tmp3); + debuga(_("(html8) Cannot open file %s: %s\n"),tmp3,strerror(errno)); exit(EXIT_FAILURE); } @@ -530,7 +530,7 @@ void htmlrel(void) limit_flag=0; if(access(PerUserLimitFile, R_OK) == 0) { if((fp_usr = fopen(PerUserLimitFile, "r")) == 0) { - debuga(_("(html9) Cannot open file %s\n"),PerUserLimitFile); + debuga(_("(html9) Cannot open file %s: %s\n"),PerUserLimitFile,strerror(errno)); exit(EXIT_FAILURE); } while(fgets(tmp6,sizeof(tmp6),fp_usr)!=NULL) { @@ -545,7 +545,7 @@ void htmlrel(void) if(!limit_flag) { if((fp_usr = fopen(PerUserLimitFile, "a")) == 0) { - debuga(_("(html10) Cannot open file %s\n"),PerUserLimitFile); + debuga(_("(html10) Cannot open file %s: %s\n"),PerUserLimitFile,strerror(errno)); exit(EXIT_FAILURE); } fprintf(fp_usr,"%s\n",uinfo->label); diff --git a/index.c b/index.c index 5b2c35e..6b306e2 100644 --- a/index.c +++ b/index.c @@ -140,7 +140,7 @@ static void make_date_index(void) order=(strcmp(IndexSortOrder,"A") == 0) ? 1 : -1; if((fp_ou=fopen(yearindex,"w"))==NULL) { - debuga(_("(index) Cannot open file %s - %s\n"),yearindex,strerror(errno)); + debuga(_("(index) Cannot open file %s: %s\n"),yearindex,strerror(errno)); exit(EXIT_FAILURE); } write_html_header(fp_ou,0,ngettext("SARG report","SARG reports",nyears),HTML_JS_NONE); @@ -192,7 +192,7 @@ static void make_date_index(void) closedir(dirp2); sprintf(monthindex,"%s/index.html",yeardir); if((fp_ou2=fopen(monthindex,"w"))==NULL) { - debuga(_("(index) Cannot open file %s - %s\n"),monthindex,strerror(errno)); + debuga(_("(index) Cannot open file %s: %s\n"),monthindex,strerror(errno)); exit(EXIT_FAILURE); } snprintf(title,sizeof(title),ngettext("SARG: report for %04d","SARG: reports for %04d",nmonths),year); @@ -253,7 +253,7 @@ static void make_date_index(void) closedir(dirp3); sprintf(dayindex,"%s/index.html",monthdir); if((fp_ou3=fopen(dayindex,"w"))==NULL) { - debuga(_("(index) Cannot open file %s - %s\n"),dayindex,strerror(errno)); + debuga(_("(index) Cannot open file %s: %s\n"),dayindex,strerror(errno)); exit(EXIT_FAILURE); } snprintf(title,sizeof(title),ngettext("SARG: report for %04d/%02d","SARG: reports for %04d/%02d",ndays),year,month); @@ -421,7 +421,7 @@ static void make_file_index(void) closedir( dirp ); if((fp_ou=fopen(wdir,"w"))==NULL) { - debuga(_("(index) Cannot open file %s\n"),wdir); + debuga(_("(index) Cannot open file %s: %s\n"),wdir,strerror(errno)); exit(EXIT_FAILURE); } write_html_header(fp_ou,0,ngettext("SARG report","SARG reports",nsort),HTML_JS_SORTTABLE); diff --git a/lastlog.c b/lastlog.c index 1db4190..cb36c54 100644 --- a/lastlog.c +++ b/lastlog.c @@ -48,7 +48,7 @@ void mklastlog(const char *outdir) snprintf(temp,sizeof(temp),"%slastlog1",outdir); if((fp_ou=fopen(temp,"w"))==NULL) { - debuga(_("(lastlog) Cannot open temporary file %s\n"),temp); + debuga(_("(lastlog) Cannot open temporary file %s: %s\n"),temp,strerror(errno)); exit(EXIT_FAILURE); } @@ -103,7 +103,7 @@ void mklastlog(const char *outdir) snprintf(temp,sizeof(temp),"%slastlog",outdir); if((fp_in=fopen(temp,"r"))==NULL) { - debuga(_("(lastlog) Cannot open temporary file %s\n"),temp); + debuga(_("(lastlog) Cannot open temporary file %s: %s\n"),temp,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/readlog.c b/readlog.c index 5d5b040..5cee0a4 100644 --- a/readlog.c +++ b/readlog.c @@ -311,7 +311,7 @@ int ReadLogFile(struct ReadLogDataStruct *Filter) exit(EXIT_FAILURE); } if((fp_log=MY_FOPEN(arq_log,"w"))==NULL) { - debuga(_("(log) Cannot open log file: %s - %s\n"),arq_log,strerror(errno)); + debuga(_("(log) Cannot open log file %s: %s\n"),arq_log,strerror(errno)); exit(EXIT_FAILURE); } fputs("*** SARG Log ***\n",fp_log); @@ -519,7 +519,7 @@ int ReadLogFile(struct ReadLogDataStruct *Filter) exit(EXIT_FAILURE); } if ((ufile->file = MY_FOPEN (tmp3, "a")) == NULL) { - debuga(_("(log) Cannot open temporary file: %s - %s\n"), tmp3, strerror(errno)); + debuga(_("(log) Cannot open temporary file %s: %s\n"), tmp3, strerror(errno)); exit (1); } } diff --git a/redirector.c b/redirector.c index 80a67b4..c7e0b67 100644 --- a/redirector.c +++ b/redirector.c @@ -264,7 +264,7 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil) } if ((fp_in=fopen(wentp,"r"))==NULL) { - debuga(_("(squidguard) Cannot open log file %s\n"),wentp); + debuga(_("(squidguard) Cannot open log file %s: %s\n"),wentp,strerror(errno)); exit(EXIT_FAILURE); } @@ -306,7 +306,7 @@ void redirector_log(void) snprintf(guard_in,sizeof(guard_in),"%s/redirector.int_unsort",tmp); if((fp_ou=fopen(guard_in,"w"))==NULL) { - debuga(_("(squidguard) Cannot open log file %s\n"),guard_in); + debuga(_("(squidguard) Cannot open log file %s: %s\n"),guard_in,strerror(errno)); exit(EXIT_FAILURE); } @@ -323,7 +323,7 @@ void redirector_log(void) } if((fp_guard=fopen(SquidGuardConf,"r"))==NULL) { - debuga(_("(squidguard) Cannot open log file %s\n"),SquidGuardConf); + debuga(_("(squidguard) Cannot open log file %s: %s\n"),SquidGuardConf,strerror(errno)); exit(EXIT_FAILURE); } @@ -455,12 +455,12 @@ void redirector_report(void) snprintf(report,sizeof(report),"%s/redirector.html",outdirname); if((fp_in=fopen(redirector_sorted,"r"))==NULL) { - debuga(_("(squidguard) Cannot open log file %s\n"),redirector_sorted); + debuga(_("(squidguard) Cannot open log file %s: %s\n"),redirector_sorted,strerror(errno)); exit(EXIT_FAILURE); } if((fp_ou=fopen(report,"w"))==NULL) { - debuga(_("(squidguard) Cannot open log file %s\n"),report); + debuga(_("(squidguard) Cannot open log file %s: %s\n"),report,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/repday.c b/repday.c index 61985dd..a220a7c 100644 --- a/repday.c +++ b/repday.c @@ -66,7 +66,7 @@ void report_day(const struct userinfostruct *uinfo) } if((fp_in=fopen(wdirname,"r"))==NULL) { - debuga(_("(repday) Cannot open log file %s\n"),wdirname); + debuga(_("(repday) Cannot open log file %s: %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); } @@ -119,7 +119,7 @@ void report_day(const struct userinfostruct *uinfo) fclose(fp_in); if((fp_ou=fopen(arqout,"w"))==NULL) { - debuga(_("(repday) Cannot open log file %s\n"),arqout); + debuga(_("(repday) Cannot open log file %s: %s\n"),arqout,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/report.c b/report.c index 6798776..e46bc75 100644 --- a/report.c +++ b/report.c @@ -100,7 +100,7 @@ void gerarel(void) snprintf(wdirname,sizeof(wdirname),"%s/sarg-general",outdirname); if((fp_gen=MY_FOPEN(wdirname,"w"))==NULL){ - debuga(_("(report) Cannot open file %s\n"),wdirname); + debuga(_("(report) Cannot open file %s: %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); } @@ -124,7 +124,7 @@ void gerarel(void) exit(EXIT_FAILURE); } if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){ - debuga(_("(report) Cannot open file %s\n"),tmp); + debuga(_("(report) Cannot open file %s: %s\n"),tmp,strerror(errno)); exit(EXIT_FAILURE); } user=uinfo->filename; @@ -247,7 +247,7 @@ void gerarel(void) url_to_file(accurl,siteind,sizeof(siteind)); snprintf(arqtt,sizeof(arqtt),"%s/%s/tt%s-%s.html",outdirname,uinfo->filename,uinfo->filename,siteind); if ((fp_tt = fopen(arqtt, "w")) == 0) { - debuga(_("(report) Cannot open file %s\n"),arqtt); + debuga(_("(report) Cannot open file %s: %s\n"),arqtt,strerror(errno)); exit(EXIT_FAILURE); } ttopen=1; @@ -434,7 +434,7 @@ static FILE *maketmp(const char *user, const char *dirname, int debug) } if((fp_ou=fopen(wdirname,"w"))==NULL){ - debuga(_("(report) Cannot open file %s\n"),wdirname); + debuga(_("(report) Cannot open file %s: %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); } @@ -475,7 +475,7 @@ static void gravaporuser(const struct userinfostruct *uinfo, const char *dirname } if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - debuga(_("(report) Cannot open file %s\n"),wdirname); + debuga(_("(report) Cannot open file %s: %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); } @@ -759,7 +759,7 @@ static void grava_SmartFilter(const char *dirname, const char *user, const char } if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - debuga(_("(report) Cannot open file %s\n"),wdirname); + debuga(_("(report) Cannot open file %s: %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/siteuser.c b/siteuser.c index 58d195f..69b15c1 100644 --- a/siteuser.c +++ b/siteuser.c @@ -71,13 +71,13 @@ void siteuser(void) } if((fp_in=fopen(general2,"r"))==NULL) { - debuga(_("(siteuser) Cannot open log file %s\n"),general2); + debuga(_("(siteuser) Cannot open log file %s: %s\n"),general2,strerror(errno)); debuga(_("sort command: %s\n"),csort); exit(EXIT_FAILURE); } if((fp_ou=fopen(report,"w"))==NULL) { - debuga(_("(siteuser) Cannot open log file %s\n"),report); + debuga(_("(siteuser) Cannot open log file %s: %s\n"),report,strerror(errno)); exit(EXIT_FAILURE); } diff --git a/smartfilter.c b/smartfilter.c index 4dd068b..12c8c69 100644 --- a/smartfilter.c +++ b/smartfilter.c @@ -81,7 +81,7 @@ void smartfilter_report(void) exit(EXIT_FAILURE); } if((fp_in=fopen(smart_ou,"r"))==NULL) { - debuga(_("(smartfilter) Cannot open log file %s\n"),smart_ou); + debuga(_("(smartfilter) Cannot open log file %s: %s\n"),smart_ou,strerror(errno)); debuga(_("sort command: %s\n"),csort); exit(EXIT_FAILURE); } @@ -91,7 +91,7 @@ void smartfilter_report(void) } if((fp_ou=fopen(report,"w"))==NULL) { - debuga(_("(smartfilter) Cannot open log file %s\n"),report); + debuga(_("(smartfilter) Cannot open log file %s: %s\n"),report,strerror(errno)); exit(EXIT_FAILURE); } @@ -143,7 +143,7 @@ void smartfilter_report(void) fclose(fp_user); } if ((fp_user = fopen(smartuser, "a")) == 0) { - debuga(_("(smartfilter) Cannot open file %s\n"),smartuser); + debuga(_("(smartfilter) Cannot open file %s: %s\n"),smartuser,strerror(errno)); exit(EXIT_FAILURE); } fuser=1; diff --git a/splitlog.c b/splitlog.c index 4a1bd63..5cd55ef 100644 --- a/splitlog.c +++ b/splitlog.c @@ -79,7 +79,7 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons arq="/var/log/squid/access.log"; if((fp_in=MY_FOPEN(arq,"r"))==NULL) { - debuga(_("(splitlog) Cannot open log file %s - %s\n"),arq,strerror(errno)); + debuga(_("(splitlog) Cannot open log file %s: %s\n"),arq,strerror(errno)); exit(EXIT_FAILURE); } @@ -119,7 +119,7 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons a second time. */ if ((fp_ou=MY_FOPEN(output_file,(tt>=min_tt && tt<=max_tt) ? "a" : "w"))==NULL) { - debuga(_("(splitlog) Cannot open output log file %s - %s\n"),output_file,strerror(errno)); + debuga(_("(splitlog) Cannot open output log file %s: %s\n"),output_file,strerror(errno)); exit(EXIT_FAILURE); } if (tt