]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - repday.c
Be more thorough when ensuring a file is correctly written
[thirdparty/sarg.git] / repday.c
index 61985dd06162bdc8a2c981aea69cd1ce80cc8886..9a412609b0c2a3f6ce7c2519dd4a848158ec7ace 100644 (file)
--- 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);
        }
 
@@ -243,7 +243,9 @@ void report_day(const struct userinfostruct *uinfo)
 
        if (write_html_trailer(fp_ou)<0)
                debuga(_("Write error in file %s\n"),arqout);
-       if (fclose(fp_ou)==EOF)
-               debuga(_("Failed to close file %s - %s\n"),arqout,strerror(errno));
+       if (fclose(fp_ou)==EOF) {
+               debuga(_("Write error in %s: %s\n"),arqout,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
        return;
 }