Higher priority; compare whole string instead substr

This commit is contained in:
topjohnwu 2016-12-30 06:05:33 +08:00
parent 0bf04c04f9
commit 632b3cb9ae

View File

@ -13,6 +13,7 @@
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/resource.h>
#define LOGFILE "/cache/magisk.log"
#define HIDELIST "/magisk/.core/magiskhide/hidelist"
@ -71,6 +72,9 @@ int hideMagisk() {
char cache_block[256], zygote_ns[2][32];
cache_block[0] = '\0';
// Set to the top priority
setpriority(PRIO_PROCESS, 0, -20);
// Get the mount namespace of zygote
FILE *p = popen("/data/busybox/ps | grep zygote | grep -v grep", "r");
while(fgets(buffer, sizeof(buffer), p)) {
@ -303,7 +307,7 @@ int main(int argc, char **argv, char **envp) {
continue;
for (i = 0; i < list_size; ++i) {
if(strstr(processName, hide_list[i])) {
if(strcmp(processName, hide_list[i]) == 0) {
// Check PID exist
if (kill(pid, 0) == -1) continue;
fprintf(logfile, "MagiskHide: %s(PID=%d ", processName, pid);