Skip to content

Commit 9a64eaa

Browse files
authored
manger: fix lkm detection (tiann#2654)
原因请看 SukiSU-Ultra/SukiSU-Ultra#217 (comment) 文中介绍的是lkm的问题 但实测下来gki也有这样的问题 但修复方法通用
1 parent fb8e3bc commit 9a64eaa

File tree

1 file changed

+7
-6
lines changed
  • manager/app/src/main/cpp

1 file changed

+7
-6
lines changed

manager/app/src/main/cpp/ksu.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ bool become_manager(const char* pkg) {
5050
}
5151

5252
// cache the result to avoid unnecessary syscall
53-
static bool is_lkm;
54-
int get_version() {
53+
static bool is_lkm = false;
54+
55+
int get_version(void) {
5556
int32_t version = -1;
56-
int32_t lkm = 0;
57-
ksuctl(CMD_GET_VERSION, &version, &lkm);
58-
if (!is_lkm && lkm != 0) {
57+
int32_t flags = 0;
58+
ksuctl(CMD_GET_VERSION, &version, &flags);
59+
if (!is_lkm && (flags & 0x1)) {
5960
is_lkm = true;
6061
}
6162
return version;
@@ -96,4 +97,4 @@ bool is_su_enabled() {
9697
// if ksuctl failed, we assume su is enabled, and it cannot be disabled.
9798
ksuctl(CMD_IS_SU_ENABLED, &enabled, nullptr);
9899
return enabled;
99-
}
100+
}

0 commit comments

Comments
 (0)