mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Fix map_file
This commit is contained in:
parent
6ee6685f4c
commit
e9cf27eb5a
@ -533,7 +533,7 @@ impl Drop for MappedFile {
|
|||||||
|
|
||||||
// We mark the returned slice static because it is valid until explicitly unmapped
|
// We mark the returned slice static because it is valid until explicitly unmapped
|
||||||
pub(crate) fn map_file(path: &CStr, rw: bool) -> io::Result<&'static mut [u8]> {
|
pub(crate) fn map_file(path: &CStr, rw: bool) -> io::Result<&'static mut [u8]> {
|
||||||
let flag = if rw { O_RDONLY } else { O_RDWR };
|
let flag = if rw { O_RDWR } else { O_RDONLY };
|
||||||
let fd = open_fd!(path, flag | O_CLOEXEC)?;
|
let fd = open_fd!(path, flag | O_CLOEXEC)?;
|
||||||
map_fd(fd.as_fd(), fd.size()?, rw)
|
map_fd(fd.as_fd(), fd.size()?, rw)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user