From af0216251b94e751baa47146ac9609db70793b8e Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Mon, 19 Jun 2017 00:52:38 -0400 Subject: curl_setup_once: Remove ERRNO/SET_ERRNO macros Prior to this change (SET_)ERRNO mapped to GetLastError/SetLastError for Win32 and regular errno otherwise. I reviewed the code and found no justifiable reason for conflating errno on WIN32 with GetLastError/SetLastError. All Win32 CRTs support errno, and any Win32 multithreaded CRT supports thread-local errno. Fixes https://github.com/curl/curl/issues/895 Closes https://github.com/curl/curl/pull/1589 --- lib/telnet.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/telnet.c') diff --git a/lib/telnet.c b/lib/telnet.c index 122100523..269b193d0 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -1357,14 +1357,14 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) /* load ws2_32.dll and get the function pointers we need. */ wsock2 = Curl_load_library(TEXT("WS2_32.DLL")); if(wsock2 == NULL) { - failf(data, "failed to load WS2_32.DLL (%d)", ERRNO); + failf(data, "failed to load WS2_32.DLL (%u)", GetLastError()); return CURLE_FAILED_INIT; } /* Grab a pointer to WSACreateEvent */ create_event_func = GetProcAddress(wsock2, "WSACreateEvent"); if(create_event_func == NULL) { - failf(data, "failed to find WSACreateEvent function (%d)", ERRNO); + failf(data, "failed to find WSACreateEvent function (%u)", GetLastError()); FreeLibrary(wsock2); return CURLE_FAILED_INIT; } @@ -1372,7 +1372,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) /* And WSACloseEvent */ close_event_func = GetProcAddress(wsock2, "WSACloseEvent"); if(close_event_func == NULL) { - failf(data, "failed to find WSACloseEvent function (%d)", ERRNO); + failf(data, "failed to find WSACloseEvent function (%u)", GetLastError()); FreeLibrary(wsock2); return CURLE_FAILED_INIT; } @@ -1380,7 +1380,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) /* And WSAEventSelect */ event_select_func = GetProcAddress(wsock2, "WSAEventSelect"); if(event_select_func == NULL) { - failf(data, "failed to find WSAEventSelect function (%d)", ERRNO); + failf(data, "failed to find WSAEventSelect function (%u)", GetLastError()); FreeLibrary(wsock2); return CURLE_FAILED_INIT; } @@ -1388,7 +1388,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) /* And WSAEnumNetworkEvents */ enum_netevents_func = GetProcAddress(wsock2, "WSAEnumNetworkEvents"); if(enum_netevents_func == NULL) { - failf(data, "failed to find WSAEnumNetworkEvents function (%d)", ERRNO); + failf(data, "failed to find WSAEnumNetworkEvents function (%u)", + GetLastError()); FreeLibrary(wsock2); return CURLE_FAILED_INIT; } @@ -1581,7 +1582,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) /* We called LoadLibrary, so call FreeLibrary */ if(!FreeLibrary(wsock2)) - infof(data, "FreeLibrary(wsock2) failed (%d)", ERRNO); + infof(data, "FreeLibrary(wsock2) failed (%u)", GetLastError()); #else pfd[0].fd = sockfd; pfd[0].events = POLLIN; -- cgit v1.2.3