From c9cdd560608982bba458ec4d1ddc862e64978dce Mon Sep 17 00:00:00 2001 From: Alexander Vdolainen Date: Fri, 31 Jul 2015 22:52:58 +0300 Subject: [PATCH] fixed win32 hostname resolve; --- lib/sntllv2.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/sntllv2.c b/lib/sntllv2.c index 2b4c36c..08bc71d 100644 --- a/lib/sntllv2.c +++ b/lib/sntllv2.c @@ -513,7 +513,9 @@ static void __connection_destroy(conn_t *co) if(co->pctx->login) free(co->pctx->login); if(co->pctx->passwd) free(co->pctx->passwd); - SSL_shutdown(co->ssl); + while((fd = SSL_shutdown(co->ssl)) != 1) { + if(fd < 0) break; + } fd = SSL_get_fd(co->ssl); SSL_free(co->ssl); SSL_CTX_free(co->ctx); @@ -1085,13 +1087,17 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host, /* resolve host */ #ifdef WIN32 host_ = gethostbyname(host); + if(!host_) { + r = SNE_FAILED; + goto __fail; + } #else r = __resolvehost(host, hostbuf, 2048, &host_); -#endif if(r) { r = SNE_FAILED; goto __fail; } +#endif /* create a socket */ sck = socket(PF_INET, SOCK_STREAM, 0);