Skip to content

Commit d38f20d

Browse files
committed
Auto merge of #10157 - luqmana:opnotsupp, r=ehuss
Treat EOPNOTSUPP the same as ENOTSUP when ignoring failed flock calls. On some platforms, `ENOTSUP` and `EOPNOTSUPP` are distinct and it's not consistent which error is returned. e.g. the BSDs will return `EOPNOTSUPP` ([FreeBSD](https://www.freebsd.org/cgi/man.cgi?query=flock&sektion=2#ERRORS), [OpenBSD](https://man.openbsd.org/flock.2#ERRORS)) whereas [macOS](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/flock.2.html) returns `ENOTSUP`.
2 parents 451a043 + 6963df3 commit d38f20d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cargo/util/flock.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ mod sys {
374374

375375
pub(super) fn error_unsupported(err: &Error) -> bool {
376376
match err.raw_os_error() {
377-
Some(libc::ENOTSUP) => true,
377+
// Unfortunately, depending on the target, these may or may not be the same.
378+
// For targets in which they are the same, the duplicate pattern causes a warning.
379+
#[allow(unreachable_patterns)]
380+
Some(libc::ENOTSUP | libc::EOPNOTSUPP) => true,
378381
#[cfg(target_os = "linux")]
379382
Some(libc::ENOSYS) => true,
380383
_ => false,

0 commit comments

Comments
 (0)