openbsd-ports/www/sarg/patches/patch-splitlog_c
aanriot cb891b737b update to 2.2.3.1 .
from Douglas Santos;
tested by michele@ and myself
2007-05-16 15:59:23 +00:00

34 lines
1.1 KiB
Plaintext

$openBSD$
--- splitlog.c.orig Tue Nov 29 17:39:45 2005
+++ splitlog.c Thu Jan 26 21:31:44 2006
@@ -39,7 +39,7 @@ void splitlog(char *arq, char *df, int d
struct tm *t;
if(arq[0] == '\0')
- strcpy(arq,"/usr/local/squid/logs/access.log");
+ strcpy(arq,"/var/squid/logs/access.log");
if((fp_in=fopen(arq,"r"))==NULL) {
fprintf(stderr, "SARG: (splitlog) %s: %s\n",text[8],arq);
@@ -52,7 +52,7 @@ void splitlog(char *arq, char *df, int d
t=localtime(&tt);
if(dfrom) {
- strftime(wdata, 127, "%Y%m%d", t);
+ strftime(wdata, sizeof(wdata), "%Y%m%d", t);
idata=atoi(wdata);
if(idata < dfrom || idata > duntil)
continue;
@@ -64,9 +64,9 @@ void splitlog(char *arq, char *df, int d
}
if(strncmp(df,"e",1) == 0)
- strftime(dia, 127, "%d/%m/%Y", t);
+ strftime(dia, sizeof(dia), "%d/%m/%Y", t);
else
- strftime(dia, 127, "%m/%d/%Y", t);
+ strftime(dia, sizeof(dia), "%m/%d/%Y", t);
sprintf(hora,"%02d:%02d:%02d",t->tm_hour,t->tm_min,t->tm_sec);
printf("%s %s %s",dia,hora,buf);