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.
cute-signatures
Timo Teras 2009-01-16 14:52:47 +02:00
parent 3e6fc1389f
commit 6b6c10cdf2
1 changed files with 1 additions and 0 deletions

View File

@ -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) {