@@ -2401,7 +2401,7 @@ _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b)
2401
2401
do {
2402
2402
PySSL_BEGIN_ALLOW_THREADS
2403
2403
retval = SSL_write_ex (self -> ssl , b -> buf , (size_t )b -> len , & count );
2404
- err = _PySSL_errno (retval == 0 , self -> ssl , count );
2404
+ err = _PySSL_errno (retval <= 0 , self -> ssl , retval );
2405
2405
PySSL_END_ALLOW_THREADS
2406
2406
self -> err = err ;
2407
2407
@@ -2434,7 +2434,7 @@ _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b)
2434
2434
err .ssl == SSL_ERROR_WANT_WRITE );
2435
2435
2436
2436
Py_XDECREF (sock );
2437
- if (retval = = 0 )
2437
+ if (retval < = 0 )
2438
2438
return PySSL_SetError (self , retval , __FILE__ , __LINE__ );
2439
2439
if (PySSL_ChainExceptions (self ) < 0 )
2440
2440
return NULL ;
@@ -2553,7 +2553,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
2553
2553
do {
2554
2554
PySSL_BEGIN_ALLOW_THREADS
2555
2555
retval = SSL_read_ex (self -> ssl , mem , (size_t )len , & count );
2556
- err = _PySSL_errno (retval == 0 , self -> ssl , count );
2556
+ err = _PySSL_errno (retval <= 0 , self -> ssl , retval );
2557
2557
PySSL_END_ALLOW_THREADS
2558
2558
self -> err = err ;
2559
2559
@@ -2586,7 +2586,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
2586
2586
} while (err .ssl == SSL_ERROR_WANT_READ ||
2587
2587
err .ssl == SSL_ERROR_WANT_WRITE );
2588
2588
2589
- if (retval = = 0 ) {
2589
+ if (retval < = 0 ) {
2590
2590
PySSL_SetError (self , retval , __FILE__ , __LINE__ );
2591
2591
goto error ;
2592
2592
}
0 commit comments