From de116af023c1bcabe862b222a1008d8dccee73c3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 20 Oct 2009 18:13:19 +0400 Subject: * Fix reading of last block --- src/statfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/statfile.c') diff --git a/src/statfile.c b/src/statfile.c index e44af6c2b..d8eb7635e 100644 --- a/src/statfile.c +++ b/src/statfile.c @@ -445,7 +445,7 @@ statfile_pool_get_block (statfile_pool_t * pool, stat_file_t * file, uint32_t h1 block = (struct stat_file_block *)c; for (i = 0; i < CHAIN_LENGTH; i++) { - if (i + blocknum > file->cur_section.length) { + if (i + blocknum >= file->cur_section.length) { break; } if (block->hash1 == h1 && block->hash2 == h2) { @@ -482,7 +482,7 @@ statfile_pool_set_block_common (statfile_pool_t * pool, stat_file_t * file, uint block = (struct stat_file_block *)c; for (i = 0; i < CHAIN_LENGTH; i++) { - if (i + blocknum > file->cur_section.length) { + if (i + blocknum >= file->cur_section.length) { /* Need to expire some block in chain */ msg_debug ("statfile_pool_set_block: chain %u is full, starting expire", blocknum); break; -- cgit v1.2.3