fs_init(): skip mounting proc/dev/sys if already mounted

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-05-31 17:35:07 +02:00
parent d25c1d5564
commit 09b9e26b2d
+9
View File
@@ -295,6 +295,15 @@ static void fs_init(void)
for (i = 0; i < NELEMS(fs); i++) {
int rc;
/*
* Check if already mounted, we may be running in a
* container, or an initramfs ran before us. The
* function fismnt() reliles on /proc/mounts being
* unique for each chroot/container.
*/
if (fismnt(fs[i].file))
continue;
rc = mount(fs[i].spec, fs[i].file, fs[i].type, 0, NULL);
if (rc && errno != EBUSY)
_pe("Failed mounting %s on %s", fs[i].spec, fs[i].file);