Maintain a list of pre-init mounts

Keep track of everything to unmount
This commit is contained in:
topjohnwu
2019-07-16 23:54:52 -07:00
parent aa47966347
commit 736729f5ef
3 changed files with 15 additions and 5 deletions

View File

@ -109,10 +109,12 @@ static void main_daemon() {
restore_rootcon();
// Unmount pre-init patches
umount2("/init", MNT_DETACH);
umount2("/init.rc", MNT_DETACH);
umount2("/system/lib/libselinux.so", MNT_DETACH);
umount2("/system/lib64/libselinux.so", MNT_DETACH);
if (access(ROOTMNT, F_OK) == 0) {
file_readline(ROOTMNT, [](auto line) -> bool {
umount2(line.data(), MNT_DETACH);
return true;
}, true);
}
int fd = xopen("/dev/null", O_RDWR | O_CLOEXEC);
xdup2(fd, STDOUT_FILENO);