summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/database.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index e064ca5..e5d8b86 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1660,6 +1660,12 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
if (fd >= 0) close(fd);
db->cache_dir = apk_static_cache_dir;
db->cache_fd = openat(db->root_fd, db->cache_dir, O_RDONLY | O_CLOEXEC);
+ if (db->cache_fd < 0) {
+ mkdirat(db->root_fd, "var/cache", 0755);
+ mkdirat(db->root_fd, "var/cache/apk", 0755);
+ db->cache_fd = openat(db->root_fd, db->cache_dir, O_RDONLY | O_CLOEXEC);
+ if (db->cache_fd < 0) goto ret_errno;
+ }
}
db->keys_fd = openat(db->root_fd,