Handle cygwin select() returning -1 with errno 0

This commit is contained in:
A2uria
2025-07-25 22:45:01 +08:00
parent d8e5821a3b
commit 4508b5b0db

View File

@@ -389,7 +389,9 @@ fn run(self) {
drop(data);
let ret =
fds.check_readable(timeout.map(Timeout::Duration).unwrap_or(Timeout::Forever));
if ret < 0 && !matches!(errno().0, libc::EINTR | libc::EBADF) {
// Cygwin reports ret < 0 && errno == 0 as success.
let err = errno().0;
if ret < 0 && !matches!(err, libc::EINTR | libc::EBADF) && !(cfg!(cygwin) && err == 0) {
// Surprising error
perror("select");
}