Commit aa92e4cb authored by topjohnwu's avatar topjohnwu

Fix stupid bug in MagiskHide

parent e603877a
...@@ -75,6 +75,10 @@ void launch_magiskhide(int client) { ...@@ -75,6 +75,10 @@ void launch_magiskhide(int client) {
close(sv[1]); close(sv[1]);
// Initialize the mutex lock
pthread_mutex_init(&hide_lock, NULL);
pthread_mutex_init(&file_lock, NULL);
// Initialize the hide list // Initialize the hide list
if (init_list()) if (init_list())
goto error; goto error;
...@@ -82,10 +86,6 @@ void launch_magiskhide(int client) { ...@@ -82,10 +86,6 @@ void launch_magiskhide(int client) {
// Add SafetyNet by default // Add SafetyNet by default
add_list(strdup("com.google.android.gms.unstable")); add_list(strdup("com.google.android.gms.unstable"));
// Initialize the mutex lock
pthread_mutex_init(&hide_lock, NULL);
pthread_mutex_init(&file_lock, NULL);
write_int(client, DAEMON_SUCCESS); write_int(client, DAEMON_SUCCESS);
close(client); close(client);
......
...@@ -30,6 +30,7 @@ static void read_namespace(const int pid, char* target, const size_t size) { ...@@ -30,6 +30,7 @@ static void read_namespace(const int pid, char* target, const size_t size) {
// Workaround for the lack of pthread_cancel // Workaround for the lack of pthread_cancel
static void quit_pthread(int sig) { static void quit_pthread(int sig) {
err_handler = do_nothing;
LOGD("proc_monitor: running cleanup\n"); LOGD("proc_monitor: running cleanup\n");
destroy_list(); destroy_list();
free(buffer); free(buffer);
...@@ -71,7 +72,7 @@ void proc_monitor() { ...@@ -71,7 +72,7 @@ void proc_monitor() {
struct sigaction act; struct sigaction act;
memset(&act, 0, sizeof(act)); memset(&act, 0, sizeof(act));
act.sa_handler = quit_pthread; act.sa_handler = quit_pthread;
sigaction(SIGPIPE, &act, NULL); sigaction(SIGUSR1, &act, NULL);
// The error handler should stop magiskhide services // The error handler should stop magiskhide services
err_handler = proc_monitor_err; err_handler = proc_monitor_err;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment