From f539c14d99ae380508d6b82f1ebfc9841e61fb4e Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sat, 21 Mar 2026 09:23:55 +0800 Subject: [PATCH] Fix EAGAIN/EWOULDBLOCK check in AsyncUDPSocketTest recvmsg error handling Use && instead of || when checking errno. Since errno has a single value, (errno != EAGAIN || errno != EWOULDBLOCK) is always true. The correct logic is to only report errors when errno is neither EAGAIN nor EWOULDBLOCK. --- folly/io/async/test/AsyncUDPSocketTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/io/async/test/AsyncUDPSocketTest.cpp b/folly/io/async/test/AsyncUDPSocketTest.cpp index 632873c8cc2..a9412b0fadb 100644 --- a/folly/io/async/test/AsyncUDPSocketTest.cpp +++ b/folly/io/async/test/AsyncUDPSocketTest.cpp @@ -371,7 +371,7 @@ class UDPNotifyClient : public UDPClient { ssize_t ret = sock.recvmsg(&msg, 0); if (ret < 0) { - if (errno != EAGAIN || errno != EWOULDBLOCK) { + if (errno != EAGAIN && errno != EWOULDBLOCK) { onReadError( folly::AsyncSocketException( folly::AsyncSocketException::NETWORK_ERROR, "error"));