1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

sync: move call to unsafe fn to unsafe block

This commit is contained in:
Daniel Hofstetter 2025-05-16 15:14:21 +02:00 committed by Sylvestre Ledru
parent 6a828f0e74
commit cdca6d6a8d

View file

@ -40,10 +40,10 @@ mod platform {
/// # Safety /// # Safety
/// This function is unsafe because it calls `libc::sync` or `libc::syscall` which are unsafe. /// This function is unsafe because it calls `libc::sync` or `libc::syscall` which are unsafe.
pub unsafe fn do_sync() -> UResult<()> { pub unsafe fn do_sync() -> UResult<()> {
// see https://github.com/rust-lang/libc/pull/2161
#[cfg(target_os = "android")]
libc::syscall(libc::SYS_sync);
unsafe { unsafe {
// see https://github.com/rust-lang/libc/pull/2161
#[cfg(target_os = "android")]
libc::syscall(libc::SYS_sync);
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
libc::sync(); libc::sync();
} }