Commit aa92e4cb authored by topjohnwu's avatar topjohnwu

Fix stupid bug in MagiskHide

parent e603877a
......@@ -75,6 +75,10 @@ void launch_magiskhide(int client) {
close(sv[1]);
// Initialize the mutex lock
pthread_mutex_init(&hide_lock, NULL);
pthread_mutex_init(&file_lock, NULL);
// Initialize the hide list
if (init_list())
goto error;
......@@ -82,10 +86,6 @@ void launch_magiskhide(int client) {
// Add SafetyNet by default
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);
close(client);
......
......@@ -30,6 +30,7 @@ static void read_namespace(const int pid, char* target, const size_t size) {
// Workaround for the lack of pthread_cancel
static void quit_pthread(int sig) {
err_handler = do_nothing;
LOGD("proc_monitor: running cleanup\n");
destroy_list();
free(buffer);
......@@ -71,7 +72,7 @@ void proc_monitor() {
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_handler = quit_pthread;
sigaction(SIGPIPE, &act, NULL);
sigaction(SIGUSR1, &act, NULL);
// The error handler should stop magiskhide services
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