From: Frédéric Marchal Date: Sat, 8 Jan 2011 20:11:26 +0000 (+0000) Subject: Fix the parsing of the sarg log file name X-Git-Tag: v2.3.2~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddd6dbdc8d1822125c821223ef660541886c5298;p=thirdparty%2Fsarg.git Fix the parsing of the sarg log file name The parsed log file created when parsed_output_log is set is using a completly numerical date but, when the log file is read again, sarg expects the month to be a name and therefore reject the file as having an invalid name. Thanks to kodemi for identifying the problem. --- diff --git a/util.c b/util.c index 2807460..7c9c58e 100644 --- a/util.c +++ b/util.c @@ -718,7 +718,6 @@ int getperiod_fromsarglog(const char *arqtt,struct periodstruct *period) const char *str; int day0, month0, year0, hour0, minute0; int day1, month1, year1, hour1, minute1; - char month[4]; int i; memset(period,0,sizeof(*period)); @@ -729,11 +728,9 @@ int getperiod_fromsarglog(const char *arqtt,struct periodstruct *period) if (!isdigit(str[0]) || !isdigit(str[1])) continue; day0=(str[0]-'0')*10+(str[1]-'0'); str+=2; - strncpy(month,str,3); - month[3]=0; - month0=month2num(month); + month0=(str[0]-'0')*10+(str[1]-'0'); if (month0>=12) continue; - str+=3; + str+=2; year0=0; for (i=0 ; isdigit(str[i]) && i<4 ; i++) year0=year0*10+(str[i]-'0'); if (i!=4) continue; @@ -754,11 +751,9 @@ int getperiod_fromsarglog(const char *arqtt,struct periodstruct *period) if (!isdigit(str[0]) || !isdigit(str[1])) continue; day1=(str[0]-'0')*10+(str[1]-'0'); str+=2; - strncpy(month,str,3); - month[3]=0; - month1=month2num(month); + month1=(str[0]-'0')*10+(str[1]-'0'); if (month1>=12) continue; - str+=3; + str+=2; year1=0; for (i=0 ; isdigit(str[i]) && i<4 ; i++) year1=year1*10+(str[i]-'0'); if (i!=4) continue;