Use WSAGetLastError() on windows
[openssl.git] / crypto / bio / b_addr.c
index 8f94fe8ffb118a663d1bb9a4097659b34990b310..61714e5602aaf746d0874fb8706ec0d5aa8a51f6 100644 (file)
@@ -715,8 +715,12 @@ int BIO_lookup(const char *host, const char *service,
             he = gethostbyname(host);
 
             if (he == NULL) {
+#ifndef OPENSSL_SYS_WINDOWS
                 BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
                 ERR_add_error_data(1, hstrerror(h_errno));
+#else
+                SYSerr(SYS_F_GETHOSTBYNAME, WSAGetLastError());
+#endif
                 ret = 0;
                 goto err;
             }
@@ -747,8 +751,12 @@ int BIO_lookup(const char *host, const char *service,
                 se = getservbyname(service, proto);
 
                 if (se == NULL) {
+#ifndef OPENSSL_SYS_WINDOWS
                     BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
                     ERR_add_error_data(1, hstrerror(h_errno));
+#else
+                    SYSerr(SYS_F_GETSERVBYNAME, WSAGetLastError());
+#endif
                     goto err;
                 }
             } else {