You've already forked KernelSU
mirror of
https://github.com/tiann/KernelSU.git
synced 2025-08-27 23:46:34 +00:00
manger: fix lkm detection (#2654)
原因请看 https://github.com/SukiSU-Ultra/SukiSU-Ultra/pull/217#issuecomment-3004461174 文中介绍的是lkm的问题 但实测下来gki也有这样的问题 但修复方法通用
This commit is contained in:
@@ -50,12 +50,13 @@ bool become_manager(const char* pkg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cache the result to avoid unnecessary syscall
|
// cache the result to avoid unnecessary syscall
|
||||||
static bool is_lkm;
|
static bool is_lkm = false;
|
||||||
int get_version() {
|
|
||||||
|
int get_version(void) {
|
||||||
int32_t version = -1;
|
int32_t version = -1;
|
||||||
int32_t lkm = 0;
|
int32_t flags = 0;
|
||||||
ksuctl(CMD_GET_VERSION, &version, &lkm);
|
ksuctl(CMD_GET_VERSION, &version, &flags);
|
||||||
if (!is_lkm && lkm != 0) {
|
if (!is_lkm && (flags & 0x1)) {
|
||||||
is_lkm = true;
|
is_lkm = true;
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
@@ -96,4 +97,4 @@ bool is_su_enabled() {
|
|||||||
// if ksuctl failed, we assume su is enabled, and it cannot be disabled.
|
// if ksuctl failed, we assume su is enabled, and it cannot be disabled.
|
||||||
ksuctl(CMD_IS_SU_ENABLED, &enabled, nullptr);
|
ksuctl(CMD_IS_SU_ENABLED, &enabled, nullptr);
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user