Skip to content

Commit 9a6ca26

Browse files
authored
Fix DoRead() returns error errno (#3248)
1 parent 0565d8d commit 9a6ca26

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/brpc/socket.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,12 +2106,14 @@ ssize_t Socket::DoRead(size_t size_hint) {
21062106
<< ": " << SSLError(e);
21072107
errno = ESSL;
21082108
} else {
2109+
int saved_errno = errno;
21092110
// System error with corresponding errno set.
21102111
bool is_fatal_error = (ssl_error != SSL_ERROR_ZERO_RETURN &&
21112112
ssl_error != SSL_ERROR_SYSCALL) ||
2112-
BIO_fd_non_fatal_error(errno) != 0 ||
2113+
BIO_fd_non_fatal_error(saved_errno) != 0 ||
21132114
nr < 0;
21142115
PLOG_IF(WARNING, is_fatal_error) << "Fail to read from ssl_fd=" << fd();
2116+
errno = saved_errno;
21152117
}
21162118
break;
21172119
}

0 commit comments

Comments
 (0)