Seperate logging to another header

This commit is contained in:
topjohnwu
2017-09-14 21:54:56 +08:00
parent 7394ff9346
commit 1816ca6b02
9 changed files with 72 additions and 60 deletions

View File

@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "utils.h"
#include "magisk.h"
@@ -16,6 +17,21 @@ char *applet[] =
int (*applet_main[]) (int, char *[]) =
{ su_client_main, resetprop_main, secilc_main, magiskpolicy_main, magiskpolicy_main, magiskpolicy_main, magiskhide_main, NULL };
int create_links(const char *bin, const char *path) {
char self[PATH_MAX], linkpath[PATH_MAX];
if (bin == NULL) {
xreadlink("/proc/self/exe", self, sizeof(self));
bin = self;
}
int ret = 0;
for (int i = 0; applet[i]; ++i) {
snprintf(linkpath, sizeof(linkpath), "%s/%s", path, applet[i]);
unlink(linkpath);
ret |= symlink(bin, linkpath);
}
return ret;
}
// Global error hander function
// Should be changed each thread/process
__thread void (*err_handler)(void);