mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-11 02:12:20 +00:00
Support SELinux disabled on debug builds
This commit is contained in:
@@ -257,7 +257,7 @@ static void handle_request(pollfd *pfd) {
|
||||
}
|
||||
break;
|
||||
case MainRequest::ZYGISK:
|
||||
if (!is_zygote) {
|
||||
if (!is_zygote && selinux_enabled()) {
|
||||
// Invalid client context
|
||||
write_int(client, MainResponse::ACCESS_DENIED);
|
||||
goto done;
|
||||
|
||||
@@ -66,6 +66,8 @@ static void restore_magiskcon(int dirfd) {
|
||||
}
|
||||
|
||||
void restorecon() {
|
||||
if (!selinux_enabled())
|
||||
return;
|
||||
int fd = xopen(SELINUX_CONTEXT, O_WRONLY | O_CLOEXEC);
|
||||
if (write(fd, ADB_CON, sizeof(ADB_CON)) >= 0)
|
||||
lsetfilecon(SECURE_DIR, ADB_CON);
|
||||
@@ -76,6 +78,8 @@ void restorecon() {
|
||||
}
|
||||
|
||||
void restore_tmpcon() {
|
||||
if (!selinux_enabled())
|
||||
return;
|
||||
if (MAGISKTMP == "/sbin")
|
||||
setfilecon(MAGISKTMP.data(), ROOT_CON);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user