From 4b9f6d430f04e4470cf5d49ee72a43ebaed0fb62 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 13 Mar 2017 12:54:39 +0000 Subject: [PATCH 1/2] db: prevent umount /proc when it was mounted by someone else This fixes regression introduced by commit 72b878e655 --- src/database.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/database.c b/src/database.c index e3ced7d..356907e 100644 --- a/src/database.c +++ b/src/database.c @@ -1581,8 +1581,13 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) if (errno == ENOENT) mkdir(db->root_proc_dir, 0555); stfs.f_type = 0; } - if (stfs.f_type != PROC_SUPER_MAGIC) + if (stfs.f_type != PROC_SUPER_MAGIC) { mount("proc", db->root_proc_dir, "proc", 0, 0); + } else { + /* was already mounted. prevent umount on close */ + free(db->root_proc_dir); + db->root_proc_dir = NULL; + } } blob = APK_BLOB_STR("+etc\n" "@etc/init.d\n" "!etc/apk\n"); -- 2.11.1