diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-07-31 19:35:08 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-07-31 19:35:08 +0300 |
commit | 123226bad255ec6918aea7b837369a8d32084329 (patch) | |
tree | 859b3586401d8241214aceba9f910f804dcb3bdf /src/database.c | |
parent | ea901526648c43ef8e961b3d7e051b9ca14b65ca (diff) | |
download | apk-tools-123226bad255ec6918aea7b837369a8d32084329.tar.gz apk-tools-123226bad255ec6918aea7b837369a8d32084329.tar.bz2 apk-tools-123226bad255ec6918aea7b837369a8d32084329.tar.xz apk-tools-123226bad255ec6918aea7b837369a8d32084329.zip |
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.
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c index e71f4c2..f6121b3 100644 --- a/src/database.c +++ b/src/database.c @@ -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); + } } } |