1 diff -urp mysql-5.7.36.org/vio/viossl.c mysql-5.7.36/vio/viossl.c
2 --- mysql-5.7.36.org/vio/viossl.c 2021-09-07 07:26:47.000000000 +0200
3 +++ mysql-5.7.36/vio/viossl.c 2021-11-29 10:34:20.106597290 +0100
4 @@ -137,7 +137,7 @@ static my_bool ssl_should_retry(Vio *vio
5 enum enum_vio_io_event *event,
6 unsigned long *ssl_errno_holder)
9 + int ssl_error, err_error;
10 SSL *ssl= vio->ssl_arg;
11 my_bool should_retry= TRUE;
13 @@ -148,12 +148,23 @@ static my_bool ssl_should_retry(Vio *vio
16 case SSL_ERROR_WANT_READ:
17 + err_error = ssl_error; // for backward compatibility.
18 *event= VIO_IO_EVENT_READ;
20 case SSL_ERROR_WANT_WRITE:
21 + err_error = ssl_error; // for backward compatibility.
22 *event= VIO_IO_EVENT_WRITE;
25 + /* first save the top ERR error */
27 + /* TODO: when wolfSSL issue 4240 is fixed (see bug 27855668) remove the
29 + err_error = ssl_error;
31 + err_error = ERR_get_error();
33 + /* now report all remaining errors on and/or clear the error stack */
34 #ifndef NDEBUG /* Debug build */
35 /* Note: the OpenSSL error queue gets cleared in report_errors(). */
37 @@ -166,7 +177,7 @@ static my_bool ssl_should_retry(Vio *vio
41 - *ssl_errno_holder= ssl_error;
42 + *ssl_errno_holder= err_error;