From: Frédéric Marchal Date: Wed, 4 May 2011 09:34:24 +0000 (+0000) Subject: Fix the error messages when parsing a redirector log with custom format X-Git-Tag: v2.3.2~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d4c97986f54adcfd0c7ec7b502e4ad683894ba5;p=thirdparty%2Fsarg.git Fix the error messages when parsing a redirector log with custom format If redirector_log_format is set in sarg.conf, the error messages displayed for any error encountered while parsing the format string are unclear or wrong. This patch fix the message and explain really why the format string could not be used. --- diff --git a/squidguard_log.c b/squidguard_log.c index 16406b9..325a3ff 100644 --- a/squidguard_log.c +++ b/squidguard_log.c @@ -105,7 +105,7 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil) getword_start(&gwarea1,RedirectorLogFormat); leks[0]='\0'; if (getword(leks,sizeof(leks),&gwarea1,'#')<0) { - debuga(_("There is a broken record or garbage in your %s file\n"),wentp); + debuga(_("Invalid \"redirector_log_format\" option in your sarg.conf (too many characters before first tag)\n")); exit(EXIT_FAILURE); } year=0; @@ -118,13 +118,17 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil) user[0]='\0'; url[0]='\0'; while(strcmp(leks,"end") != 0) { - if (getword(leks,sizeof(leks),&gwarea1,'#')<0 || getword(sep,sizeof(sep),&gwarea1,'#')<0) { - debuga(_("Maybe you have a broken record or garbage in your %s file\n"),wentp); + if (getword(leks,sizeof(leks),&gwarea1,'#')<0) { + debuga(_("Invalid \"redirector_log_format\" option in your sarg.conf (missing # at end of tag)\n")); + exit(EXIT_FAILURE); + } + if (getword(sep,sizeof(sep),&gwarea1,'#')<0) { + debuga(_("Invalid \"redirector_log_format\" option in your sarg.conf (too many characters in column separator)\n")); exit(EXIT_FAILURE); } if(strcmp(leks,"end") != 0) { if (getword_limit(res,sizeof(res),&gwarea,sep[0])<0) { - debuga(_("Maybe you have a broken record or garbage in your %s file\n"),wentp); + debuga(_("Parsing of tag \"%s\" in redirector log %s returned no result\n"),leks,wentp); exit(EXIT_FAILURE); } if(strcmp(leks,"year") == 0) {