fix csum calculation of not 'chunk_size' aligned images

the last chunk does not have to be as big as the chunk_size,
just use the already available 'chunk_end' function which does the
correct thing

this fixes restoration of images whose sizes are not a multiple of
'chunk_size' as well

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-06-04 10:12:10 +02:00 committed by Thomas Lamprecht
parent 620911b426
commit a95a3fb893
1 changed files with 1 additions and 1 deletions

View File

@ -198,7 +198,7 @@ impl FixedIndexReader {
let mut csum = openssl::sha::Sha256::new();
let mut chunk_end = 0;
for pos in 0..self.index_length {
chunk_end = ((pos + 1) * self.chunk_size) as u64;
chunk_end = self.chunk_end(pos);
let digest = self.chunk_digest(pos);
csum.update(digest);
}