X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=auth.c;h=2c0ee326e65d82dba0ab9524f6c293ecdf92a4ec;hb=e8f5438cab16bd559634c865d5d6f3ba60e7f7ac;hp=18f4f3312afe7fce83f2044cb851a64540777d6f;hpb=5f46190e0e20b982462ab90d4d17e3db73e47fba;p=thirdparty%2Fsarg.git diff --git a/auth.c b/auth.c index 18f4f33..2c0ee32 100644 --- a/auth.c +++ b/auth.c @@ -1,6 +1,6 @@ /* * SARG Squid Analysis Report Generator http://sarg.sourceforge.net - * 1998, 2011 + * 1998, 2015 * * SARG donations: * please look at http://sarg.sourceforge.net/donations.php @@ -39,16 +39,17 @@ void htaccess(const struct userinfostruct *uinfo) return; if (snprintf(htname,sizeof(htname),"%s/%s/.htaccess",outdirname,uinfo->filename)>=sizeof(htname)) { - debuga(_("File name too long: %s/%s/.htaccess\n"),outdirname,uinfo->filename); + debuga(__FILE__,__LINE__,_("Path too long: ")); + debuga_more("%s/%s/.htaccess\n",outdirname,uinfo->filename); exit(EXIT_FAILURE); } if((fp_auth=fopen(htname,"w"))==NULL) { - debuga(_("(auth) Cannot open file: %s - %s\n"),htname,strerror(errno)); + debuga(__FILE__,__LINE__,_("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(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),AuthUserTemplateFile,strerror(errno)); exit(EXIT_FAILURE); } @@ -61,8 +62,14 @@ void htaccess(const struct userinfostruct *uinfo) fputc(line[i],fp_auth); } } - fclose(fp_auth); - fclose(fp_in); + if (fclose(fp_auth)==EOF) { + debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),htname,strerror(errno)); + exit(EXIT_FAILURE); + } + if (fclose(fp_in)==EOF) { + debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),AuthUserTemplateFile,strerror(errno)); + exit(EXIT_FAILURE); + } return; }