mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-16 07:22:41 +00:00
'magiskboot hexpatch' will exit with status 1 when nothing patched.
This commit is contained in:
@@ -16,8 +16,9 @@ static void hex2byte(uint8_t *hex, uint8_t *str) {
|
||||
}
|
||||
}
|
||||
|
||||
void hexpatch(const char *image, const char *from, const char *to) {
|
||||
int hexpatch(const char *image, const char *from, const char *to) {
|
||||
int patternsize = strlen(from) / 2, patchsize = strlen(to) / 2;
|
||||
int patched = 1;
|
||||
size_t filesize;
|
||||
uint8_t *file, *pattern, *patch;
|
||||
mmap_rw(image, file, filesize);
|
||||
@@ -31,9 +32,12 @@ void hexpatch(const char *image, const char *from, const char *to) {
|
||||
memset(file + i, 0, patternsize);
|
||||
memcpy(file + i, patch, patchsize);
|
||||
i += patternsize - 1;
|
||||
patched = 0;
|
||||
}
|
||||
}
|
||||
munmap(file, filesize);
|
||||
free(pattern);
|
||||
free(patch);
|
||||
|
||||
return patched;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user