Skip to content

Commit 14a78df

Browse files
committed
Auto merge of #51790 - pietroalbini:beta-backports, r=pietroalbini
[beta] Rollup backports Merged and approved: * #51785: Use fstatat64 where available r? @ghost
2 parents 5981061 + 2d77acc commit 14a78df

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: src/libstd/sys/unix/fs.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ use sys_common::{AsInner, FromInner};
2525

2626
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))]
2727
use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64, readdir64_r, open64};
28+
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
29+
use libc::fstatat64;
2830
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))]
29-
use libc::{fstatat, dirfd};
31+
use libc::dirfd;
3032
#[cfg(target_os = "android")]
31-
use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, lseek64,
33+
use libc::{stat as stat64, fstat as fstat64, fstatat as fstatat64, lstat as lstat64, lseek64,
3234
dirent as dirent64, open as open64};
3335
#[cfg(not(any(target_os = "linux",
3436
target_os = "emscripten",
@@ -299,10 +301,7 @@ impl DirEntry {
299301
let fd = cvt(unsafe {dirfd(self.dir.0.dirp.0)})?;
300302
let mut stat: stat64 = unsafe { mem::zeroed() };
301303
cvt(unsafe {
302-
fstatat(fd,
303-
self.entry.d_name.as_ptr(),
304-
&mut stat as *mut _ as *mut _,
305-
libc::AT_SYMLINK_NOFOLLOW)
304+
fstatat64(fd, self.entry.d_name.as_ptr(), &mut stat, libc::AT_SYMLINK_NOFOLLOW)
306305
})?;
307306
Ok(FileAttr { stat: stat })
308307
}

0 commit comments

Comments
 (0)