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
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 [1]. Cargo should perhaps return unsupported
if a platform is marked unsupported by libstd.
Without this, some people on Termux may be affected I guess?
[1]: e9b6085088/library/std/src/sys/fs/unix.rs (L1395-L1410)
This commit is contained in:
parent
9eb32405e9
commit
8f51d7f68b
@ -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