summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index 626c0fb..32f224d 100644
--- a/src/database.c
+++ b/src/database.c
@@ -638,6 +638,7 @@ int apk_db_open(struct apk_database *db, const char *root)
list_init(&db->installed.packages);
if (root != NULL) {
+ fchdir(apk_cwd_fd);
db->root = strdup(root);
db->root_fd = open(root, O_RDONLY);
if (db->root_fd < 0) {