summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-31 19:35:08 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-31 19:35:08 +0300
commit123226bad255ec6918aea7b837369a8d32084329 (patch)
tree859b3586401d8241214aceba9f910f804dcb3bdf /src/database.c
parentea901526648c43ef8e961b3d7e051b9ca14b65ca (diff)
downloadapk-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.c10
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);
+ }
}
}