db: load cache's installed index only if cache is active

other wise cache_fd points to var/lib/apk and contains the real
installed db causing it to be loaded twice.
cute-signatures
Timo Teras 2009-07-31 19:35:08 +03:00
parent ea90152664
commit 123226bad2
1 changed files with 6 additions and 4 deletions

View File

@ -749,10 +749,12 @@ static int apk_db_read_state(struct apk_database *db, int flags)
bs->close(bs, NULL);
}
bs = apk_bstream_from_file(db->cache_fd, "installed");
if (bs != NULL) {
apk_db_index_read(db, bs, -2);
bs->close(bs, NULL);
if (apk_db_cache_active(db)) {
bs = apk_bstream_from_file(db->cache_fd, "installed");
if (bs != NULL) {
apk_db_index_read(db, bs, -2);
bs->close(bs, NULL);
}
}
}