summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-03-13 12:54:39 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-03-13 14:55:36 +0100
commit93d6b2b5299cd6be8123499486243547d1b9fdb8 (patch)
tree62c3ca6c6c07c13b99f13f7075dd5015efd5316d /src
parent17ba5dc11c3d1db8be0fbe1ce54e9f9b75b1825d (diff)
downloadapk-tools-93d6b2b5299cd6be8123499486243547d1b9fdb8.tar.bz2
apk-tools-93d6b2b5299cd6be8123499486243547d1b9fdb8.tar.xz
db: prevent umount /proc when it was mounted by someone else
This fixes regression introduced by commit 72b878e655
Diffstat (limited to 'src')
-rw-r--r--src/database.c7
1 files changed, 6 insertions, 1 deletions
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");