db: handle default root correctly for /proc

dbopts->root may be null; use db->root instead

fixes #7162
cute-signatures
Timo Teräs 2017-10-10 11:38:07 +03:00
parent 342909da68
commit 97e4d0531f
1 changed files with 1 additions and 1 deletions

View File

@ -1581,7 +1581,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
apk_blob_to_file(db->root_fd, apk_arch_file, *db->arch, APK_BTF_ADD_EOL); apk_blob_to_file(db->root_fd, apk_arch_file, *db->arch, APK_BTF_ADD_EOL);
/* mount /proc */ /* mount /proc */
if (asprintf(&db->root_proc_dir, "%s/proc", dbopts->root) == -1) if (asprintf(&db->root_proc_dir, "%s/proc", db->root) == -1)
goto ret_errno; goto ret_errno;
if (statfs(db->root_proc_dir, &stfs) != 0) { if (statfs(db->root_proc_dir, &stfs) != 0) {
if (errno == ENOENT) mkdir(db->root_proc_dir, 0555); if (errno == ENOENT) mkdir(db->root_proc_dir, 0555);