mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-22 17:29:20 -08:00
Improve byte_data const correctness
This commit is contained in:
@@ -164,27 +164,27 @@ static void extract_files(bool sbin) {
|
||||
const char *stub_xz = sbin ? "/sbin/stub.xz" : "stub.xz";
|
||||
|
||||
if (access(m32, F_OK) == 0) {
|
||||
auto magisk = mmap_data(m32);
|
||||
mmap_data magisk(m32);
|
||||
unlink(m32);
|
||||
int fd = xopen("magisk32", O_WRONLY | O_CREAT, 0755);
|
||||
unxz(fd, magisk.buf, magisk.sz);
|
||||
unxz(fd, magisk.buf(), magisk.sz());
|
||||
close(fd);
|
||||
}
|
||||
if (access(m64, F_OK) == 0) {
|
||||
auto magisk = mmap_data(m64);
|
||||
mmap_data magisk(m64);
|
||||
unlink(m64);
|
||||
int fd = xopen("magisk64", O_WRONLY | O_CREAT, 0755);
|
||||
unxz(fd, magisk.buf, magisk.sz);
|
||||
unxz(fd, magisk.buf(), magisk.sz());
|
||||
close(fd);
|
||||
xsymlink("./magisk64", "magisk");
|
||||
} else {
|
||||
xsymlink("./magisk32", "magisk");
|
||||
}
|
||||
if (access(stub_xz, F_OK) == 0) {
|
||||
auto stub = mmap_data(stub_xz);
|
||||
mmap_data stub(stub_xz);
|
||||
unlink(stub_xz);
|
||||
int fd = xopen("stub.apk", O_WRONLY | O_CREAT, 0);
|
||||
unxz(fd, stub.buf, stub.sz);
|
||||
unxz(fd, stub.buf(), stub.sz());
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
@@ -242,11 +242,11 @@ void MagiskInit::patch_ro_root() {
|
||||
// Handle avd hack
|
||||
if (avd_hack) {
|
||||
int src = xopen("/init", O_RDONLY | O_CLOEXEC);
|
||||
auto init = mmap_data("/init");
|
||||
mmap_data init("/init");
|
||||
// Force disable early mount on original init
|
||||
init.patch({ make_pair("android,fstab", "xxx") });
|
||||
int dest = xopen(ROOTOVL "/init", O_CREAT | O_WRONLY | O_CLOEXEC, 0);
|
||||
xwrite(dest, init.buf, init.sz);
|
||||
xwrite(dest, init.buf(), init.sz());
|
||||
fclone_attr(src, dest);
|
||||
close(src);
|
||||
close(dest);
|
||||
|
||||
Reference in New Issue
Block a user