diff --git a/jni/main.c b/jni/main.c index af85c1b1f..289594ef2 100644 --- a/jni/main.c +++ b/jni/main.c @@ -22,7 +22,7 @@ __thread void (*err_handler)(void); static void usage() { fprintf(stderr, - "Magisk v" xstr(VERSION) " multi-call binary\n" + "Magisk v" xstr(MAGISK_VERSION) " multi-call binary\n" "\n" "Usage: %s [applet [arguments]...]\n" " or: %s --install [SOURCE] \n" diff --git a/jni/utils/misc.c b/jni/utils/misc.c index 09b5f05fa..b731a8f31 100644 --- a/jni/utils/misc.c +++ b/jni/utils/misc.c @@ -134,12 +134,15 @@ static void (*ps_filter_cb)(int); static const char *ps_filter_pattern; static void proc_name_filter(int pid) { char buf[64]; + int fd; snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid); - int fd = xopen(buf, O_RDONLY); + if ((fd = open(buf, O_RDONLY)) == -1) + return; if (fdgets(buf, sizeof(buf), fd) == 0) { snprintf(buf, sizeof(buf), "/proc/%d/comm", pid); close(fd); - fd = xopen(buf, O_RDONLY); + if ((fd = open(buf, O_RDONLY)) == -1) + return; fdgets(buf, sizeof(buf), fd); } if (strstr(buf, ps_filter_pattern)) {