From aefbc1c9bfac109238fd40f593fa095b2d09c700 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 17 Apr 2017 16:33:01 +0800 Subject: [PATCH] Move the helper function to higher level --- misc.c | 16 ---------------- su.c | 2 +- su.h | 2 -- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/misc.c b/misc.c index 06b8654f1..d980bbcf0 100644 --- a/misc.c +++ b/misc.c @@ -13,22 +13,6 @@ #include "magisk.h" #include "su.h" -int quit_signals[] = { SIGALRM, SIGABRT, SIGHUP, SIGPIPE, SIGQUIT, SIGTERM, SIGINT, 0 }; - -void setup_sighandlers(void (*handler)(int)) { - struct sigaction act; - - // Install the termination handlers - // Note: we're assuming that none of these signal handlers are already trapped. - // If they are, we'll need to modify this code to save the previous handler and - // call it after we restore stdin to its previous state. - memset(&act, 0, sizeof(act)); - act.sa_handler = handler; - for (int i = 0; quit_signals[i]; ++i) { - sigaction(quit_signals[i], &act, NULL); - } -} - void set_identity(unsigned uid) { /* * Set effective uid back to root, otherwise setres[ug]id will fail diff --git a/su.c b/su.c index 1fa210fb0..29a400b3d 100644 --- a/su.c +++ b/su.c @@ -214,7 +214,7 @@ int su_daemon_main(int argc, char **argv) { .database_path = APPLICATION_DATA_PATH REQUESTOR_DATABASE_PATH, .base_path = APPLICATION_DATA_PATH REQUESTOR }, - .umask = umask(027), + .umask = umask(022), }; su_ctx = &ctx; diff --git a/su.h b/su.h index 7c13289c2..190aaccd3 100644 --- a/su.h +++ b/su.h @@ -103,7 +103,6 @@ typedef enum { } policy_t; extern int from_uid, from_pid; -extern int quit_signals[]; // su.c @@ -127,7 +126,6 @@ policy_t database_check(struct su_context *ctx); // misc.c -void setup_sighandlers(void (*handler)(int)); void set_identity(unsigned uid); char *get_command(const struct su_request *to); int fork_zero_fucks();