Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions manager/app/src/main/cpp/ksu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ bool become_manager(const char* pkg) {
}

// cache the result to avoid unnecessary syscall
static bool is_lkm;
int get_version() {
static bool is_lkm = false;

int get_version(void) {
int32_t version = -1;
int32_t lkm = 0;
ksuctl(CMD_GET_VERSION, &version, &lkm);
if (!is_lkm && lkm != 0) {
int32_t flags = 0;
ksuctl(CMD_GET_VERSION, &version, &flags);
if (!is_lkm && (flags & 0x1)) {
is_lkm = true;
}
return version;
Expand Down Expand Up @@ -96,4 +97,4 @@ bool is_su_enabled() {
// if ksuctl failed, we assume su is enabled, and it cannot be disabled.
ksuctl(CMD_IS_SU_ENABLED, &enabled, nullptr);
return enabled;
}
}
Loading