Commit aefbc1c9 authored by topjohnwu's avatar topjohnwu

Move the helper function to higher level

parent c37a2e61
...@@ -13,22 +13,6 @@ ...@@ -13,22 +13,6 @@
#include "magisk.h" #include "magisk.h"
#include "su.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) { void set_identity(unsigned uid) {
/* /*
* Set effective uid back to root, otherwise setres[ug]id will fail * Set effective uid back to root, otherwise setres[ug]id will fail
......
...@@ -214,7 +214,7 @@ int su_daemon_main(int argc, char **argv) { ...@@ -214,7 +214,7 @@ int su_daemon_main(int argc, char **argv) {
.database_path = APPLICATION_DATA_PATH REQUESTOR_DATABASE_PATH, .database_path = APPLICATION_DATA_PATH REQUESTOR_DATABASE_PATH,
.base_path = APPLICATION_DATA_PATH REQUESTOR .base_path = APPLICATION_DATA_PATH REQUESTOR
}, },
.umask = umask(027), .umask = umask(022),
}; };
su_ctx = &ctx; su_ctx = &ctx;
......
...@@ -103,7 +103,6 @@ typedef enum { ...@@ -103,7 +103,6 @@ typedef enum {
} policy_t; } policy_t;
extern int from_uid, from_pid; extern int from_uid, from_pid;
extern int quit_signals[];
// su.c // su.c
...@@ -127,7 +126,6 @@ policy_t database_check(struct su_context *ctx); ...@@ -127,7 +126,6 @@ policy_t database_check(struct su_context *ctx);
// misc.c // misc.c
void setup_sighandlers(void (*handler)(int));
void set_identity(unsigned uid); void set_identity(unsigned uid);
char *get_command(const struct su_request *to); char *get_command(const struct su_request *to);
int fork_zero_fucks(); int fork_zero_fucks();
......
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