db: catch asprintf failure

cute-signatures
Natanael Copa 2017-03-13 12:57:43 +00:00
parent 93d6b2b529
commit bcb4b06ff8
1 changed files with 2 additions and 1 deletions

View File

@ -1576,7 +1576,8 @@ 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);
/* mount /proc */
asprintf(&db->root_proc_dir, "%s/proc", dbopts->root);
if (asprintf(&db->root_proc_dir, "%s/proc", dbopts->root) == -1)
goto ret_errno;
if (statfs(db->root_proc_dir, &stfs) != 0) {
if (errno == ENOENT) mkdir(db->root_proc_dir, 0555);
stfs.f_type = 0;