summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-08 16:19:53 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-08 16:19:53 +0300
commitf1125dfcde748300846f9fba07f29791ec980c1a (patch)
tree9109d569b46430023ba4ac475433561ea886a8ed
parenta3d19b5c0dccab79d25dc9aca3f6ce731b1ac62c (diff)
downloadapk-tools-f1125dfcde748300846f9fba07f29791ec980c1a.tar.gz
apk-tools-f1125dfcde748300846f9fba07f29791ec980c1a.tar.bz2
apk-tools-f1125dfcde748300846f9fba07f29791ec980c1a.tar.xz
apk-tools-f1125dfcde748300846f9fba07f29791ec980c1a.zip
db: check cache directory early
we need to know if caching is enabled, before the repositories are added. otherwise the cache is not used properly at db opening time.
-rw-r--r--src/database.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database.c b/src/database.c
index 2edbadd..729d604 100644
--- a/src/database.c
+++ b/src/database.c
@@ -688,6 +688,9 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
}
fchdir(db->root_fd);
+ if (stat(apk_linked_cache_dir, &st) == 0 && S_ISDIR(st.st_mode))
+ db->cache_dir = apk_linked_cache_dir;
+
if (flags & APK_OPENF_WRITE) {
db->lock_fd = open("var/lib/apk/lock",
O_CREAT | O_WRONLY, 0400);
@@ -753,9 +756,6 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
free(blob.ptr);
}
}
-
- if (stat(apk_linked_cache_dir, &st) == 0 && S_ISDIR(st.st_mode))
- db->cache_dir = apk_linked_cache_dir;
}
if (!(flags & APK_OPENF_NO_REPOS)) {