Skip to content

Commit c9e9cfe

Browse files
committed
linux/utimesat.rs is used on non-Linux targets too.
1 parent f6d772f commit c9e9cfe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/wasi-common/yanix/src/sys/linux/utimesat.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ use crate::{cstr, from_success_code};
44
use std::fs;
55
use std::io::Result;
66

7+
#[cfg(not(any(target_os = "linux", target_os = "emscripten", target_os = "l4re")))]
8+
use libc::openat as libc_openat;
9+
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))]
10+
use libc::openat64 as libc_openat;
11+
712
/// Combines `openat` with `utimes` to emulate `utimensat` on platforms where it is
813
/// not available. The logic for setting file times is based on [filetime::unix::set_file_handles_times].
914
///
@@ -23,7 +28,7 @@ pub fn utimesat(
2328
if symlink_nofollow {
2429
flags |= libc::O_NOFOLLOW;
2530
}
26-
let fd = unsafe { libc::openat64(dirfd.as_raw_fd(), path.as_ptr(), flags) };
31+
let fd = unsafe { libc_openat(dirfd.as_raw_fd(), path.as_ptr(), flags) };
2732
let f = unsafe { fs::File::from_raw_fd(fd) };
2833
let (atime, mtime) = get_times(atime, mtime, || f.metadata().map_err(Into::into))?;
2934
let times = [to_timeval(atime)?, to_timeval(mtime)?];

0 commit comments

Comments
 (0)