Guard magiskhide state with mutexes

This commit is contained in:
topjohnwu
2020-05-16 23:31:30 -07:00
parent 1bcef38739
commit eca2168685
3 changed files with 27 additions and 20 deletions
+2 -4
View File
@@ -16,8 +16,6 @@
using namespace std::literals;
bool hide_enabled = false;
[[noreturn]] static void usage(char *arg0) {
fprintf(stderr,
NAME_WITH_VER(MagiskHide) "\n\n"
@@ -47,7 +45,7 @@ void magiskhide_handler(int client) {
case ADD_HIDELIST:
case RM_HIDELIST:
case LS_HIDELIST:
if (!hide_enabled) {
if (!hide_enabled()) {
write_int(client, HIDE_NOT_ENABLED);
close(client);
return;
@@ -72,7 +70,7 @@ void magiskhide_handler(int client) {
client = -1;
break;
case HIDE_STATUS:
res = hide_enabled ? HIDE_IS_ENABLED : HIDE_NOT_ENABLED;
res = hide_enabled() ? HIDE_IS_ENABLED : HIDE_NOT_ENABLED;
break;
}