Commit d2051748 authored by vvb2060's avatar vvb2060 Committed by John Wu

Prevent multiple mounts of devpts

parent 713ce471
...@@ -349,13 +349,15 @@ static void daemon_entry() { ...@@ -349,13 +349,15 @@ static void daemon_entry() {
// Use isolated devpts if kernel support // Use isolated devpts if kernel support
if (access("/dev/pts/ptmx", F_OK) == 0) { if (access("/dev/pts/ptmx", F_OK) == 0) {
auto pts = MAGISKTMP + "/" SHELLPTS; auto pts = MAGISKTMP + "/" SHELLPTS;
xmkdirs(pts.data(), 0755); if (access(pts.data(), F_OK)) {
xmount("devpts", pts.data(), "devpts", xmkdirs(pts.data(), 0755);
MS_NOSUID | MS_NOEXEC, "newinstance"); xmount("devpts", pts.data(), "devpts",
auto ptmx = pts + "/ptmx"; MS_NOSUID | MS_NOEXEC, "newinstance");
if (access(ptmx.data(), F_OK)) { auto ptmx = pts + "/ptmx";
xumount(pts.data()); if (access(ptmx.data(), F_OK)) {
rmdir(pts.data()); xumount(pts.data());
rmdir(pts.data());
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment