This is an automated email from the ASF dual-hosted git repository.

guangmingchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 9a6ca260 Fix DoRead() returns error errno (#3248)
9a6ca260 is described below

commit 9a6ca260e2e3bd989a998b0574d37e51335e3059
Author: Bright Chen <[email protected]>
AuthorDate: Wed Mar 25 19:54:57 2026 +0800

    Fix DoRead() returns error errno (#3248)
---
 src/brpc/socket.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp
index c123fb6b..da926c9f 100644
--- a/src/brpc/socket.cpp
+++ b/src/brpc/socket.cpp
@@ -2106,12 +2106,14 @@ ssize_t Socket::DoRead(size_t size_hint) {
                          << ": " << SSLError(e);
             errno = ESSL;
         } else {
+            int saved_errno = errno;
             // System error with corresponding errno set.
             bool is_fatal_error = (ssl_error != SSL_ERROR_ZERO_RETURN &&
                                    ssl_error != SSL_ERROR_SYSCALL) ||
-                                   BIO_fd_non_fatal_error(errno) != 0 ||
+                                   BIO_fd_non_fatal_error(saved_errno) != 0 ||
                                   nr < 0;
             PLOG_IF(WARNING, is_fatal_error) << "Fail to read from ssl_fd=" << 
fd();
+            errno = saved_errno;
         }
         break;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to