Move the helper function to higher level
This commit is contained in:
parent
c37a2e61ed
commit
aefbc1c9bf
16
misc.c
16
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
|
||||
|
2
su.c
2
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;
|
||||
|
||||
|
2
su.h
2
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();
|
||||
|
Loading…
Reference in New Issue
Block a user