Check binary existence before injecting zygisk bins

This commit is contained in:
Wang Han 2025-06-02 00:39:41 +08:00 committed by John Wu
parent 898580bf90
commit 5e050d7456

View File

@ -440,12 +440,19 @@ fn inject_zygisk_bins(system: &mut FsNode, name: &str) {
#[cfg(target_pointer_width = "32")]
bin_path.append_path("magisk");
children.insert(
name.to_string(),
FsNode::File {
src: bin_path.to_owned(),
},
);
// There are some devices that announce ABI as 64 bit only, but ship with linker64
// because they make use of a special 32 bit to 64 bit translator (such as tango).
// In this case, magisk32 does not exist, so inserting it will cause bind mount
// failure and affect module mount. Native bridge injection does not support these
// kind of translators anyway, so simply check if magisk32 exists here.
if bin_path.exists() {
children.insert(
name.to_string(),
FsNode::File {
src: bin_path.to_owned(),
},
);
}
}
}