diff --git a/native/jni/core/daemon.c b/native/jni/core/daemon.c index ed7ab1c86..cdce32f13 100644 --- a/native/jni/core/daemon.c +++ b/native/jni/core/daemon.c @@ -25,7 +25,7 @@ int is_daemon_init = 0, seperate_vendor = 0; static void *request_handler(void *args) { int client = *((int *) args); free(args); - client_request req = read_int(client); + int req = read_int(client); struct ucred credential; get_client_cred(client, &credential); diff --git a/native/jni/include/daemon.h b/native/jni/include/daemon.h index 13f324575..5dfdc36d6 100644 --- a/native/jni/include/daemon.h +++ b/native/jni/include/daemon.h @@ -11,7 +11,7 @@ extern int is_daemon_init, seperate_vendor; // Commands require connecting to daemon -typedef enum { +enum { DO_NOTHING = 0, LAUNCH_MAGISKHIDE, STOP_MAGISKHIDE, @@ -25,10 +25,10 @@ typedef enum { POST_FS_DATA, LATE_START, TEST -} client_request; +}; // Return codes for daemon -typedef enum { +enum { DAEMON_ERROR = -1, DAEMON_SUCCESS = 0, ROOT_REQUIRED, @@ -36,7 +36,7 @@ typedef enum { HIDE_NOT_ENABLED, HIDE_ITEM_EXIST, HIDE_ITEM_NOT_EXIST, -} daemon_response; +}; // daemon.c diff --git a/native/jni/magiskhide/hide_utils.c b/native/jni/magiskhide/hide_utils.c index e37e4c14d..4476372e2 100644 --- a/native/jni/magiskhide/hide_utils.c +++ b/native/jni/magiskhide/hide_utils.c @@ -113,7 +113,7 @@ int rm_list(char *proc) { return HIDE_NOT_ENABLED; } - daemon_response ret = DAEMON_ERROR; + int ret = DAEMON_ERROR; char *line; int do_rm = 0; struct vector *new_list = xmalloc(sizeof(*new_list)); diff --git a/native/jni/magiskhide/magiskhide.c b/native/jni/magiskhide/magiskhide.c index d4952353c..339343aa9 100644 --- a/native/jni/magiskhide/magiskhide.c +++ b/native/jni/magiskhide/magiskhide.c @@ -110,7 +110,7 @@ int magiskhide_main(int argc, char *argv[]) { if (argc < 2) { usage(argv[0]); } - client_request req = DO_NOTHING; + int req = DO_NOTHING; if (strcmp(argv[1], "--enable") == 0) { req = LAUNCH_MAGISKHIDE; } else if (strcmp(argv[1], "--disable") == 0) { @@ -129,11 +129,8 @@ int magiskhide_main(int argc, char *argv[]) { if (req == ADD_HIDELIST || req == RM_HIDELIST) { write_string(fd, argv[2]); } - daemon_response code = read_int(fd); + int code = read_int(fd); switch (code) { - case DAEMON_ERROR: - fprintf(stderr, "Error occured in daemon...\n"); - return code; case DAEMON_SUCCESS: break; case ROOT_REQUIRED: @@ -151,6 +148,10 @@ int magiskhide_main(int argc, char *argv[]) { case HIDE_ITEM_NOT_EXIST: fprintf(stderr, "Process [%s] does not exist in hide list\n", argv[2]); return code; + case DAEMON_ERROR: + default: + fprintf(stderr, "Error occured in daemon...\n"); + return code; } if (req == LS_HIDELIST) {