mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-15 19:50:47 +00:00
Reorganize libutils and cleanups
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
#include "pts.h"
|
||||
#include "flags.h"
|
||||
|
||||
#define quit_signals ((int []) { SIGALRM, SIGABRT, SIGHUP, SIGPIPE, SIGQUIT, SIGTERM, SIGINT, 0 })
|
||||
|
||||
static void usage(int status) {
|
||||
FILE *stream = (status == EXIT_SUCCESS) ? stdout : stderr;
|
||||
|
||||
@@ -84,6 +86,15 @@ static void sighandler(int sig) {
|
||||
}
|
||||
}
|
||||
|
||||
static void setup_sighandlers(void (*handler)(int)) {
|
||||
struct sigaction act;
|
||||
memset(&act, 0, sizeof(act));
|
||||
act.sa_handler = handler;
|
||||
for (int i = 0; quit_signals[i]; ++i) {
|
||||
sigaction(quit_signals[i], &act, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Connect daemon, send argc, argv, cwd, pts slave
|
||||
*/
|
||||
|
Reference in New Issue
Block a user