Merge pull request #7942 from cakebaker/sync_move_function_call_to_unsafe_block

sync: move call to unsafe fn to unsafe block
This commit is contained in:
Sylvestre Ledru
2025-05-20 09:44:48 +02:00
committed by GitHub
+3 -3
View File
@@ -40,10 +40,10 @@ mod platform {
/// # Safety
/// This function is unsafe because it calls `libc::sync` or `libc::syscall` which are unsafe.
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 {
// see https://github.com/rust-lang/libc/pull/2161
#[cfg(target_os = "android")]
libc::syscall(libc::SYS_sync);
#[cfg(not(target_os = "android"))]
libc::sync();
}