Tweak enum
This commit is contained in:
parent
49ecba2476
commit
40b6fe03c2
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user