mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 07:47:38 +00:00
Check path when start daemon
This commit is contained in:
parent
c0981174a8
commit
d19fcd5e21
@ -416,6 +416,14 @@ int connect_daemon(int req, bool create) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char buf[64];
|
||||||
|
xreadlink("/proc/self/exe", buf, sizeof(buf));
|
||||||
|
if (str_starts(buf, "/system/bin/")) {
|
||||||
|
LOGE("Start daemon on /dev or /sbin\n");
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (fork_dont_care() == 0) {
|
if (fork_dont_care() == 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
daemon_entry();
|
daemon_entry();
|
||||||
|
@ -76,13 +76,6 @@ void restorecon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void restore_tmpcon() {
|
void restore_tmpcon() {
|
||||||
if (MAGISKTMP == "/system/bin") {
|
|
||||||
// Running with emulator.sh
|
|
||||||
if (SDK_INT >= 26)
|
|
||||||
lsetfilecon("/system/bin/magisk", EXEC_CON);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MAGISKTMP == "/sbin")
|
if (MAGISKTMP == "/sbin")
|
||||||
setfilecon(MAGISKTMP.data(), ROOT_CON);
|
setfilecon(MAGISKTMP.data(), ROOT_CON);
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user