Make BIO_sock_error return a proper error code when getsockopt fails
authorRichard Levitte <levitte@openssl.org>
Thu, 28 Apr 2016 11:19:38 +0000 (13:19 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 28 Apr 2016 12:04:03 +0000 (14:04 +0200)
commit2bd8c8539595b8708e825d306a45ddddc17c915c
treef31225abf39fb06cfec5e2f02f7c4709b0bb1eee
parentd78df5dfd650e6de159a19a033513481064644f5
Make BIO_sock_error return a proper error code when getsockopt fails

BIO_sock_error() returned 1 when getsockopt() fails when it should
return the error code for that failure.

Additionally, the optlen parameter to getsockopt() has to point at
the size of the area that the optval parameter points at rather than
zero.  Some systems may forgive it being zero, but others don't.

Reviewed-by: Matt Caswell <matt@openssl.org>
crypto/bio/b_sock.c