diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /vendor/rustix/src/backend/libc/fs/dir.rs | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/backend/libc/fs/dir.rs')
-rw-r--r-- | vendor/rustix/src/backend/libc/fs/dir.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/vendor/rustix/src/backend/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs index 8e5477401..6b69c3600 100644 --- a/vendor/rustix/src/backend/libc/fs/dir.rs +++ b/vendor/rustix/src/backend/libc/fs/dir.rs @@ -242,7 +242,7 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent { // with a field that we missed here. And we can avoid blindly copying the // whole `d_name` field, which may not be entirely allocated. #[cfg_attr(target_os = "wasi", allow(unused_mut))] - #[cfg(not(target_os = "dragonfly"))] + #[cfg(not(any(target_os = "freebsd", target_os = "dragonfly")))] let mut dirent = libc_dirent { #[cfg(not(any( target_os = "aix", @@ -253,7 +253,7 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent { d_type, #[cfg(not(any( target_os = "aix", - target_os = "freebsd", + target_os = "freebsd", // Until FreeBSD 12 target_os = "haiku", target_os = "ios", target_os = "macos", @@ -306,14 +306,18 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent { pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX // */ - // On dragonfly, `dirent` has some non-public padding fields so we can't - // directly initialize it. - #[cfg(target_os = "dragonfly")] - let mut dirent = unsafe { + // On dragonfly and FreeBSD 12, `dirent` has some non-public padding fields + // so we can't directly initialize it. + #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] + let mut dirent = { let mut dirent: libc_dirent = zeroed(); dirent.d_fileno = d_fileno; dirent.d_namlen = d_namlen; dirent.d_type = d_type; + #[cfg(target_os = "freebsd")] + { + dirent.d_reclen = d_reclen; + } dirent }; |