From 8a5b6f2b86e9f6e1ca9f79597f99467e6a27b743 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 10 Feb 2019 04:18:50 -0500 Subject: [PATCH] Block all signals in daemon --- native/jni/core/daemon.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/native/jni/core/daemon.cpp b/native/jni/core/daemon.cpp index 0012bb3b5..dc61f2718 100644 --- a/native/jni/core/daemon.cpp +++ b/native/jni/core/daemon.cpp @@ -134,19 +134,11 @@ static void main_daemon() { // Change process name strcpy(argv0, "magiskd"); - // Block all user signals + // Block all signals sigset_t block_set; - sigemptyset(&block_set); - sigaddset(&block_set, SIGUSR1); - sigaddset(&block_set, SIGUSR2); + sigfillset(&block_set); pthread_sigmask(SIG_SETMASK, &block_set, nullptr); - // Ignore SIGPIPE - struct sigaction act; - memset(&act, 0, sizeof(act)); - act.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &act, nullptr); - // Loop forever to listen for requests while(true) { int *client = new int;