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" extern "C"
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_com_rifsxd_ksunext_Natives_getHookMode(JNIEnv *env, jobject) { Java_com_rifsxd_ksunext_Natives_getHookMode(JNIEnv *env, jobject) {
char mode[16] = {0}; const char* mode = get_hook_mode();
if (get_hook_mode(mode, sizeof(mode))) { return env->NewStringUTF(mode);
return env->NewStringUTF(mode);
}
return nullptr;
} }
extern "C" extern "C"

View File

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

View File

@@ -11,7 +11,7 @@ bool become_manager(const char *);
int get_version(); 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); bool get_allow_list(int *uids, int *size);