From 483ee5d6ba48dbcd8a7ad7f37fbf52ebf28db3a0 Mon Sep 17 00:00:00 2001 From: Juston Li Date: Fri, 21 Oct 2022 20:01:31 +0000 Subject: [PATCH] util/fossilize_db: don't destroy foz on RO load fail When loading multiple RO foz dbs, if a db fails to load, continue trying to load other RO foz dbs instead of destroying the foz cache. Preserve destroying the foz cache and not preceding to load RO caches if the RW cache fails to load. Signed-off-by: Juston Li Part-of: --- src/util/fossilize_db.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c index bfedc42e101..4100551c6a2 100644 --- a/src/util/fossilize_db.c +++ b/src/util/fossilize_db.c @@ -259,7 +259,6 @@ load_foz_dbs(struct foz_db *foz_db, FILE *db_idx, uint8_t file_idx, fail: flock(fileno(foz_db->file[file_idx]), LOCK_UN); - foz_destroy(foz_db); return false; } @@ -333,7 +332,10 @@ foz_prepare(struct foz_db *foz_db, char *cache_path) if (!load_foz_dbs(foz_db, db_idx, file_idx, true)) { fclose(db_idx); - goto fail; + fclose(foz_db->file[file_idx]); + foz_db->file[file_idx] = NULL; + + continue; /* Ignore invalid user provided foz db */ } fclose(db_idx);