Skip to content

Commit

Permalink
Tweak code
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Jun 21, 2024
1 parent 7effb33 commit 3cce0b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/linux_android_with_fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const FD_ONGOING_INIT: libc::c_int = -2;
static FD: AtomicI32 = AtomicI32::new(FD_UNINIT);

pub fn use_file(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
let mut fd = FD.load(Ordering::Acquire);
if fd.is_negative() {
fd = open_or_wait()?;
}
let fd = match FD.load(Ordering::Acquire) {
FD_UNINIT | FD_ONGOING_INIT => open_or_wait()?,
fd => fd,
};
sys_fill_exact(dest, |buf| unsafe {
libc::read(fd, buf.as_mut_ptr().cast::<c_void>(), buf.len())
})
Expand Down

0 comments on commit 3cce0b5

Please sign in to comment.