summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/database.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index 3e897d2..acc3acb 100644
--- a/src/database.c
+++ b/src/database.c
@@ -706,6 +706,7 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
}
}
+ fchdir(apk_cwd_fd);
return 0;
ret_errno:
@@ -713,6 +714,7 @@ ret_errno:
ret_r:
apk_error("%s: %s", msg, strerror(-r));
apk_db_close(db);
+ fchdir(apk_cwd_fd);
return r;
}