Add more checks for other patches

This commit is contained in:
topjohnwu 2017-06-03 05:08:52 +08:00
parent c282a8f328
commit 2cdbcc5666
2 changed files with 8 additions and 8 deletions

View File

@ -193,18 +193,20 @@ static void cpio_add(mode_t mode, const char *entry, const char *filename, struc
static void cpio_test(struct vector *v) { static void cpio_test(struct vector *v) {
#define MAGISK_PATCH 0x1 #define MAGISK_PATCH 0x1
#define SUPERSU_PATCH 0x2 #define OTHER_PATCH 0x2
int ret = 0; int ret = 0;
cpio_file *f; cpio_file *f;
const char *OTHER_LIST[] = { "sbin/launch_daemonsu.sh", "sbin/su", "init.xposed.rc", "init.supersu.rc", NULL };
vec_for_each(v, f) { vec_for_each(v, f) {
if (strcmp(f->filename, "sbin/launch_daemonsu.sh") == 0) { for (int i = 0; OTHER_LIST[i]; ++i) {
ret |= SUPERSU_PATCH; if (strcmp(f->filename, OTHER_LIST[i]) == 0)
} else if (strcmp(f->filename, "init.magisk.rc") == 0) { ret |= OTHER_PATCH;
ret |= MAGISK_PATCH;
} }
if (strcmp(f->filename, "init.magisk.rc") == 0)
ret |= OTHER_PATCH;
} }
cpio_vec_destroy(v); cpio_vec_destroy(v);
exit((ret & SUPERSU_PATCH) ? SUPERSU_PATCH : (ret & MAGISK_PATCH)); exit((ret & OTHER_PATCH) ? OTHER_PATCH : (ret & MAGISK_PATCH));
} }
static int check_verity_pattern(const char *s) { static int check_verity_pattern(const char *s) {

View File

@ -15,8 +15,6 @@ void unpack(const char* image) {
printf("Parsing boot image: [%s]\n\n", image); printf("Parsing boot image: [%s]\n\n", image);
parse_img(orig, size); parse_img(orig, size);
char name[PATH_MAX];
// Dump kernel // Dump kernel
if (mtk_kernel) { if (mtk_kernel) {
kernel += 512; kernel += 512;