mirror of
https://github.com/fish-shell/fish-shell
synced 2024-09-21 06:51:58 +00:00
Fix compilation on 32-bit non-Linux platforms
The `u64::from(buf.f_flag)` was needed in two places. The existing handled macOS which always has a 32-bit statfs::f_flag, but statvfs::f_flag is an `unsigned long` which means it needs to be coerced to 64-bits on 32-bit targets.
This commit is contained in:
parent
7d617d7d58
commit
6a301381c8
1 changed files with 6 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue