Browse Source

Bugfix on datemax > max date

Yann Weber 7 years ago
parent
commit
2283a16991
2 changed files with 9 additions and 6 deletions
  1. 3
    4
      src/ttail_init.c
  2. 6
    2
      src/ttail_search_files.c

+ 3
- 4
src/ttail_init.c View File

58
 	res->logfile_sz = 0;
58
 	res->logfile_sz = 0;
59
 	res->prefix_sz = -1;
59
 	res->prefix_sz = -1;
60
 	res->session = NULL;
60
 	res->session = NULL;
61
-	memset(&(res->date_min), 0, sizeof(struct tm));
62
-	memset(&(res->date_max), 0, sizeof(struct tm));
61
+	ttail_tm_init(&(res->date_min));
62
+	ttail_tm_init(&(res->date_max));
63
 
63
 
64
 	while(1)
64
 	while(1)
65
 	{
65
 	{
384
 
384
 
385
 	for(c=0;c<2;c++)
385
 	for(c=0;c<2;c++)
386
 	{
386
 	{
387
-		memset(c==0?&(res->date_min):&(res->date_max), 0, \
388
-			sizeof(struct tm));
387
+		ttail_tm_init(c==0?&(res->date_min):&(res->date_max));
389
 		if(!dates[c])
388
 		if(!dates[c])
390
 		{
389
 		{
391
 			continue;
390
 			continue;

+ 6
- 2
src/ttail_search_files.c View File

268
 			off = 0;
268
 			off = 0;
269
 			return 0;
269
 			return 0;
270
 		}
270
 		}
271
-		else if(*id == t->logfile_sz - 1 ||
272
-			cmax > 0)
271
+		else if(cmax > 0)
273
 		{
272
 		{
274
 			/* somewhere in current file */
273
 			/* somewhere in current file */
275
 			ret = _ttail_search_file_binary_search(t, in, ftm, min);
274
 			ret = _ttail_search_file_binary_search(t, in, ftm, min);
312
 			}
311
 			}
313
 			return 0;
312
 			return 0;
314
 		}
313
 		}
314
+		else if(*id == t->logfile_sz - 1 && cmax < 0)
315
+		{
316
+			*off = t->session->file.file_sz[*id];
317
+			return 0;
318
+		}
315
 		(*id)++;
319
 		(*id)++;
316
 	}
320
 	}
317
 	if(!valid)
321
 	if(!valid)

Loading…
Cancel
Save