Catch EOPNOTSUPP as failure for opportunistic flags

This commit is contained in:
Richard Gong
2025-05-29 00:57:22 -07:00
committed by Benjamin Saunders
parent 78a5a6a884
commit 2fbb2ddd1c
+2 -1
View File
@@ -1018,7 +1018,7 @@ mod gro {
/// Returns whether the given socket option is supported on the current platform
///
/// Yields `Ok(true)` if the option was set successfully, `Ok(false)` if setting
/// the option raised an `ENOPROTOOPT` error, and `Err` for any other error.
/// the option raised an `ENOPROTOOPT` or `EOPNOTSUPP` error, and `Err` for any other error.
fn set_socket_option_supported(
socket: &impl AsRawFd,
level: libc::c_int,
@@ -1028,6 +1028,7 @@ fn set_socket_option_supported(
match set_socket_option(socket, level, name, value) {
Ok(()) => Ok(true),
Err(err) if err.raw_os_error() == Some(libc::ENOPROTOOPT) => Ok(false),
Err(err) if err.raw_os_error() == Some(libc::EOPNOTSUPP) => Ok(false),
Err(err) => Err(err),
}
}