Fix stupid bug in MagiskHide

This commit is contained in:
topjohnwu 2017-05-12 15:28:15 +08:00
parent e603877a17
commit aa92e4cbd0
2 changed files with 6 additions and 5 deletions

View File

@ -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);

View File

@ -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;