summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-16 14:52:47 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-16 14:52:47 +0200
commit6b6c10cdf244d3a307df4c339cde774600d49f49 (patch)
tree005a9214ae7dc6b541ed53c8eb3287b365e96094
parent3e6fc1389f1cdd06bf18b8fd6cd741c8b9e3e1f2 (diff)
downloadapk-tools-6b6c10cdf244d3a307df4c339cde774600d49f49.tar.gz
apk-tools-6b6c10cdf244d3a307df4c339cde774600d49f49.tar.bz2
apk-tools-6b6c10cdf244d3a307df4c339cde774600d49f49.tar.xz
apk-tools-6b6c10cdf244d3a307df4c339cde774600d49f49.zip
db: fix relative --root to work after apk_db_create call
This was broke on --initdb addition to add applet since apk_db_create changes the working directory.
-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) {