Migrate magiskinit selinux.cpp to Rust

This commit is contained in:
topjohnwu
2025-04-06 02:04:59 -07:00
committed by John Wu
parent 83e66767ff
commit d4a0286e13
10 changed files with 361 additions and 260 deletions

View File

@@ -199,7 +199,7 @@ impl FsPath {
}
pub fn create(&self, flags: i32, mode: mode_t) -> io::Result<File> {
Ok(File::from(open_fd!(self, flags, mode)?))
Ok(File::from(open_fd!(self, O_CREAT | flags, mode)?))
}
pub fn exists(&self) -> bool {
@@ -431,6 +431,10 @@ impl FsPath {
pub fn create_symlink_to(&self, target: &FsPath) -> io::Result<()> {
unsafe { libc::symlink(target.as_ptr(), self.as_ptr()).as_os_err() }
}
pub fn mkfifo(&self, mode: mode_t) -> io::Result<()> {
unsafe { libc::mkfifo(self.as_ptr(), mode).as_os_err() }
}
}
impl FsPathFollow {