Skip to content

Commit c5a44d9

Browse files
killagubergwolf
authored andcommitted
fix: st_nlink in macos aarch64 is u16
Signed-off-by: killagu <[email protected]>
1 parent 2bcc32d commit c5a44d9

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/abi/fuse_abi.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -610,11 +610,23 @@ impl Attr {
610610
mode: st.st_mode,
611611
#[cfg(target_os = "macos")]
612612
mode: st.st_mode as u32,
613-
// st.st_nlink is u64 on x86_64 and powerpc64, and u32 on other architectures
614-
// ref https://github.com/rust-lang/rust/blob/1.69.0/library/std/src/os/linux/raw.rs#L333
615-
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
613+
// In Linux st.st_nlink is u64 on x86_64 and powerpc64, and u32 on other architectures
614+
// In macos, st_nlink is always u16
615+
// ref:
616+
// linux: https://github.com/rust-lang/rust/blob/1.69.0/library/std/src/os/linux/raw.rs#L333
617+
// macos: https://github.com/rust-lang/rust/blob/1.69.0/library/std/src/os/macos/raw.rs#L44
618+
#[cfg(any(
619+
target_os = "macos",
620+
all(
621+
target_os = "linux",
622+
any(target_arch = "x86_64", target_arch = "powerpc64")
623+
)
624+
))]
616625
nlink: st.st_nlink as u32,
617-
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64")))]
626+
#[cfg(all(
627+
target_os = "linux",
628+
not(any(target_arch = "x86_64", target_arch = "powerpc64"))
629+
))]
618630
nlink: st.st_nlink,
619631
uid: st.st_uid,
620632
gid: st.st_gid,

0 commit comments

Comments
 (0)