]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - topuser.c
Explain the reason when a file cannot be opened
[thirdparty/sarg.git] / topuser.c
index 48b68b1ddb91a0500bfe96e4d21de427c5c01b63..2fa4c0578c70f58c206bb53de7c440c4d1b3ede6 100644 (file)
--- a/topuser.c
+++ b/topuser.c
@@ -43,7 +43,7 @@ static void set_total_users(int totuser)
 
        snprintf(tusr,sizeof(tusr),"%s/sarg-users",outdirname);
        if((fp_ou=fopen(tusr,"w"))==NULL) {
-               debuga(_("(topuser) Cannot open file %s\n"),tusr);
+               debuga(_("(topuser) Cannot open file %s: %s\n"),tusr,strerror(errno));
                exit(EXIT_FAILURE);
        }
        fprintf(fp_ou,"%d\n",totuser);
@@ -85,13 +85,13 @@ void topuser(void)
        ntopuser = 0;
        snprintf(wger,sizeof(wger),"%s/sarg-general",outdirname);
        if((fp_in=fopen(wger,"r"))==NULL) {
-               debuga(_("(topuser) Cannot open file %s\n"),wger);
+               debuga(_("(topuser) Cannot open file %s: %s\n"),wger,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        snprintf(top2,sizeof(top2),"%s/top.tmp",outdirname);
        if((fp_top2=fopen(top2,"w"))==NULL) {
-               debuga(_("(topuser) Cannot open file %s\n"),top2);
+               debuga(_("(topuser) Cannot open file %s: %s\n"),top2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -198,7 +198,7 @@ void topuser(void)
        }
 
        if((fp_top1=fopen(top1,"r"))==NULL) {
-               debuga(_("(topuser) Cannot open file %s\n"),top1);
+               debuga(_("(topuser) Cannot open file %s: %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -209,7 +209,7 @@ void topuser(void)
 
        snprintf(top3,sizeof(top3),"%s/index.html",outdirname);
        if((fp_top3=fopen(top3,"w"))==NULL) {
-               debuga(_("(topuser) Cannot open file %s\n"),top3);
+               debuga(_("(topuser) Cannot open file %s: %s\n"),top3,strerror(errno));
                exit(EXIT_FAILURE);
        }