Use WSAGetLastError() on windows
Windows doesn't have h_error or hstrerror() Reviewed-by: Richard Levitte <levitte@openssl.org> MR: #1848
This commit is contained in:
@@ -715,8 +715,12 @@ int BIO_lookup(const char *host, const char *service,
|
|||||||
he = gethostbyname(host);
|
he = gethostbyname(host);
|
||||||
|
|
||||||
if (he == NULL) {
|
if (he == NULL) {
|
||||||
|
#ifndef OPENSSL_SYS_WINDOWS
|
||||||
BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
|
BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
|
||||||
ERR_add_error_data(1, hstrerror(h_errno));
|
ERR_add_error_data(1, hstrerror(h_errno));
|
||||||
|
#else
|
||||||
|
SYSerr(SYS_F_GETHOSTBYNAME, WSAGetLastError());
|
||||||
|
#endif
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -747,8 +751,12 @@ int BIO_lookup(const char *host, const char *service,
|
|||||||
se = getservbyname(service, proto);
|
se = getservbyname(service, proto);
|
||||||
|
|
||||||
if (se == NULL) {
|
if (se == NULL) {
|
||||||
|
#ifndef OPENSSL_SYS_WINDOWS
|
||||||
BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
|
BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
|
||||||
ERR_add_error_data(1, hstrerror(h_errno));
|
ERR_add_error_data(1, hstrerror(h_errno));
|
||||||
|
#else
|
||||||
|
SYSerr(SYS_F_GETSERVBYNAME, WSAGetLastError());
|
||||||
|
#endif
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ static ERR_STRING_DATA ERR_str_functs[] = {
|
|||||||
{ERR_PACK(0, SYS_F_SETSOCKOPT, 0), "setsockopt"},
|
{ERR_PACK(0, SYS_F_SETSOCKOPT, 0), "setsockopt"},
|
||||||
{ERR_PACK(0, SYS_F_GETSOCKOPT, 0), "getsockopt"},
|
{ERR_PACK(0, SYS_F_GETSOCKOPT, 0), "getsockopt"},
|
||||||
{ERR_PACK(0, SYS_F_GETSOCKNAME, 0), "getsockname"},
|
{ERR_PACK(0, SYS_F_GETSOCKNAME, 0), "getsockname"},
|
||||||
|
{ERR_PACK(0, SYS_F_GETHOSTBYNAME, 0), "gethostbyname"},
|
||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ typedef struct err_state_st {
|
|||||||
# define SYS_F_SETSOCKOPT 14
|
# define SYS_F_SETSOCKOPT 14
|
||||||
# define SYS_F_GETSOCKOPT 15
|
# define SYS_F_GETSOCKOPT 15
|
||||||
# define SYS_F_GETSOCKNAME 16
|
# define SYS_F_GETSOCKNAME 16
|
||||||
|
# define SYS_F_GETHOSTBYNAME 17
|
||||||
|
|
||||||
/* reasons */
|
/* reasons */
|
||||||
# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */
|
# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */
|
||||||
|
|||||||
Reference in New Issue
Block a user