Don't clobber the last error
authorMatt Caswell <matt@openssl.org>
Fri, 11 Mar 2016 16:47:42 +0000 (16:47 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 11 Mar 2016 21:32:13 +0000 (21:32 +0000)
commit81161070f8ec75ba83964e98ad70c4c4d015c276
tree23ca623e5315a32131f9255a06f4eb56741d4f27
parent642befa16e42feadd4d8d843a6d563ae4d161171
Don't clobber the last error

On Windows we call WSAGetLastError() to find out the last error that
happened on a socket operation. We use this to find out whether we can
retry the operation or not. You are supposed to call this immediately
however in a couple of places we logged an error first. This can end up
making other Windows system calls to get the thread local error state.
Sometimes that can clobber the error code, so if you call WSAGetLastError()
later on you get a spurious response and the socket operation looks like
a fatal error.

Really we shouldn't be logging an error anyway if its a retryable issue.
Otherwise we could end up with stale errors on the error queue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/bio/b_sock2.c