From 57ca07455ce03006aa4f6b66a5b0fe67570a1593 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Thu, 5 Aug 2021 03:03:48 +0200 Subject: [PATCH] util/fossilize_db: Reset file position to parsed_offset on cache_offset read failure. Otherwise we might restart reading from the middle of the entry. Fixes: 2ec1bff0f3a "util/fossilize_db: Split out reading the index." Reviewed-by: Timothy Arceri Part-of: --- src/util/fossilize_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c index 8a380812425..6737cf2b21b 100644 --- a/src/util/fossilize_db.c +++ b/src/util/fossilize_db.c @@ -157,7 +157,7 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx) uint64_t cache_offset; if (fread(&cache_offset, 1, sizeof(cache_offset), db_idx) != sizeof(cache_offset)) - return; + break; entry->offset = cache_offset;