mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
fix(flock): check if they are marked unsupported in libstd (#15941)
### What does this PR try to resolve?
This is a follow-up of <https://github.com/rust-lang/cargo/pull/15935>.
Before this Cargo invokes syscalls and check whether it gets ENOTSUP to
determine flock is unsupported. However, now the "unsupported platforms"
are pre-defined by libstd. Cargo should perhaps return unsupported if a
platform is marked unsupported by libstd.
Without this, some people on Termux may be affected I guess?
See
e9b6085088/library/std/src/sys/fs/unix.rs (L1395-L1410)
This commit is contained in:
commit
98402ac7a4
@ -435,13 +435,15 @@ fn error_unsupported(err: &std::io::Error) -> bool {
|
||||
#[allow(unreachable_patterns)]
|
||||
Some(libc::ENOTSUP | libc::EOPNOTSUPP) => true,
|
||||
Some(libc::ENOSYS) => true,
|
||||
_ => false,
|
||||
_ => err.kind() == std::io::ErrorKind::Unsupported,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn error_unsupported(err: &std::io::Error) -> bool {
|
||||
use windows_sys::Win32::Foundation::ERROR_INVALID_FUNCTION;
|
||||
err.raw_os_error()
|
||||
.map_or(false, |x| x == ERROR_INVALID_FUNCTION as i32)
|
||||
match err.raw_os_error() {
|
||||
Some(code) if code == ERROR_INVALID_FUNCTION as i32 => true,
|
||||
_ => err.kind() == std::io::ErrorKind::Unsupported,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user