-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
Description
In lib/curl_setup_once.h there is this code:
/*
* Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno
* (or equivalent) on this platform to hide platform details to code using it.
*/
#if defined(WIN32) && !defined(USE_LWIPSOCK)
#define ERRNO ((int)GetLastError())
#define SET_ERRNO(x) (SetLastError((DWORD)(x)))
#else
#define ERRNO (errno)
#define SET_ERRNO(x) (errno = (x))
#endifWindows has a CRT that uses errno, and you can set it with _set_errno. Though it is supposedly compatible with all of Windows, early versions of SDK don't seem to have the prototype. In VC6 (earliest I have) if the static library is used the errno is a global variable and you can set it directly. Update: _set_errno is available starting in VS2005.
SetLastError is for the Windows API (which the CRT calls internally) and afaik does not match up with errno. When we do stuff like SET_ERRNO(ERANGE); then in Windows it becomes SetLastError(ERANGE) and I'm pretty sure that's not correct.
Reactions are currently unavailable