diff --git a/fish-rust/src/path.rs b/fish-rust/src/path.rs index 96c64ad78..b7e3c541d 100644 --- a/fish-rust/src/path.rs +++ b/fish-rust/src/path.rs @@ -686,7 +686,9 @@ fn path_remoteness(path: &wstr) -> DirRemoteness { if unsafe { libc::statvfs(narrow.as_ptr(), &mut buf) } < 0 { return DirRemoteness::unknown; } - return if buf.f_flag & st_local != 0 { + // statvfs::f_flag is `unsigned long`, which is 4-bytes on most 32-bit targets. + #[cfg_attr(target_pointer_width = "64", allow(clippy::useless_conversion))] + return if u64::from(buf.f_flag) & st_local != 0 { DirRemoteness::local } else { DirRemoteness::remote @@ -698,6 +700,9 @@ fn path_remoteness(path: &wstr) -> DirRemoteness { if unsafe { libc::statfs(narrow.as_ptr(), &mut buf) } < 0 { return DirRemoteness::unknown; } + // statfs::f_flag is hard-coded as 64-bits on 32/64-bit FreeBSD but it's a (4-byte) + // long on 32-bit NetBSD.. and always 4-bytes on macOS (even on 64-bit builds). + #[allow(clippy::useless_conversion)] return if u64::from(buf.f_flags) & mnt_local != 0 { DirRemoteness::local } else {