manager: fix bad prctl calls for native code

This commit is contained in:
rifsxd
2025-05-21 22:55:38 +06:00
parent 324d09a61e
commit b40f2af0f0
3 changed files with 7 additions and 10 deletions

View File

@@ -28,11 +28,8 @@ Java_com_rifsxd_ksunext_Natives_getVersion(JNIEnv *env, jobject) {
extern "C"
JNIEXPORT jstring JNICALL
Java_com_rifsxd_ksunext_Natives_getHookMode(JNIEnv *env, jobject) {
char mode[16] = {0};
if (get_hook_mode(mode, sizeof(mode))) {
return env->NewStringUTF(mode);
}
return nullptr;
const char* mode = get_hook_mode();
return env->NewStringUTF(mode);
}
extern "C"

View File

@@ -62,10 +62,10 @@ int get_version() {
return version;
}
bool get_hook_mode(char *mode, int mode_len) {
if (!mode || mode_len == 0) return false;
memset(mode, 0, mode_len);
return ksuctl(CMD_HOOK_MODE, mode, nullptr);
const char* get_hook_mode() {
static char mode[16];
ksuctl(CMD_HOOK_MODE, mode, nullptr);
return mode;
}
bool get_allow_list(int *uids, int *size) {

View File

@@ -11,7 +11,7 @@ bool become_manager(const char *);
int get_version();
bool get_hook_mode(char *mode, int mode_len);
const char* get_hook_mode();
bool get_allow_list(int *uids, int *size);