diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-07 07:47:40 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-07 07:47:40 +0000 |
commit | 82849c97dd42961521fce3a084cb53dfdf94c6df (patch) | |
tree | 0780311f2e4c0692514f058c00be7c5fb2a953eb /ext/openssl/ossl_ssl.c | |
parent | 9f19f36ed5be8025ea4a900bb93b03aa30e4a03b (diff) | |
download | ruby-82849c97dd42961521fce3a084cb53dfdf94c6df.tar.gz |
* ext/openssl/ossl_ssl.c (ossl_start_ssl, ossl_ssl_read,
ossl_ssl_write): need to set errno on Win32 platform.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_ssl.c')
-rw-r--r-- | ext/openssl/ossl_ssl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 323dc97f83..d527f5ddc5 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -433,6 +433,12 @@ ossl_ssl_setup(VALUE self) return Qtrue; } +#ifdef _WIN32 +#define ssl_get_error(ssl, ret) (errno = GetLastError(), SSL_get_error(ssl, ret)) +#else +#define ssl_get_error(ssl, ret) SSL_get_error(ssl, ret) +#endif + static VALUE ossl_start_ssl(VALUE self, int (*func)()) { @@ -447,7 +453,7 @@ ossl_start_ssl(VALUE self, int (*func)()) SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void *)cb); for(;;){ if((ret = func(ssl)) > 0) break; - switch(SSL_get_error(ssl, ret)){ + switch(ssl_get_error(ssl, ret)){ case SSL_ERROR_WANT_WRITE: rb_io_wait_writable(fptr->fd); continue; @@ -503,7 +509,7 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self) rb_thread_wait_fd(fptr->fd); for (;;){ nread = SSL_read(ssl, RSTRING(str)->ptr, RSTRING(str)->len); - switch(SSL_get_error(ssl, nread)){ + switch(ssl_get_error(ssl, nread)){ case SSL_ERROR_NONE: goto end; case SSL_ERROR_ZERO_RETURN: @@ -550,7 +556,7 @@ ossl_ssl_write(VALUE self, VALUE str) if (ssl) { for (;;){ nwrite = SSL_write(ssl, RSTRING(str)->ptr, RSTRING(str)->len); - switch(SSL_get_error(ssl, nwrite)){ + switch(ssl_get_error(ssl, nwrite)){ case SSL_ERROR_NONE: goto end; case SSL_ERROR_WANT_WRITE: |