summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-03-13 12:57:43 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-03-13 14:55:36 +0100
commitbcb4b06ff86b3305d01a3aa7b22213d1349c737a (patch)
tree2661ecf377398844ee814e6f955c1cc60f74b90b /src/database.c
parent93d6b2b5299cd6be8123499486243547d1b9fdb8 (diff)
downloadapk-tools-bcb4b06ff86b3305d01a3aa7b22213d1349c737a.tar.gz
apk-tools-bcb4b06ff86b3305d01a3aa7b22213d1349c737a.tar.bz2
apk-tools-bcb4b06ff86b3305d01a3aa7b22213d1349c737a.tar.xz
apk-tools-bcb4b06ff86b3305d01a3aa7b22213d1349c737a.zip
db: catch asprintf failure
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index 356907e..80b80e9 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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;