Better bytes support in C++

This commit is contained in:
topjohnwu
2023-06-06 17:11:42 -07:00
parent f8c38eab74
commit 5e2ef1b7f4
12 changed files with 89 additions and 75 deletions

View File

@@ -244,7 +244,9 @@ void MagiskInit::patch_ro_root() {
int src = xopen("/init", O_RDONLY | O_CLOEXEC);
mmap_data init("/init");
// Force disable early mount on original init
init.patch({ make_pair("android,fstab", "xxx") });
for (size_t off : init.patch("android,fstab", "xxx")) {
LOGD("Patch @ %08zX [android,fstab] -> [xxx]\n", off);
}
int dest = xopen(ROOTOVL "/init", O_CREAT | O_WRONLY | O_CLOEXEC, 0);
xwrite(dest, init.buf(), init.sz());
fclone_attr(src, dest);