diff options
Diffstat (limited to 'src/interfaces/libpq/win32.h')
-rw-r--r-- | src/interfaces/libpq/win32.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/interfaces/libpq/win32.h b/src/interfaces/libpq/win32.h index 988455a8ec1..38099b079e4 100644 --- a/src/interfaces/libpq/win32.h +++ b/src/interfaces/libpq/win32.h @@ -7,7 +7,7 @@ #define strncasecmp(a,b,c) _strnicmp(a,b,c) /* - * Some compat functions + * Some other compat functions */ #define open(a,b,c) _open(a,b,c) #define close(a) _close(a) @@ -21,18 +21,20 @@ /* * crypt not available (yet) */ -#define crypt(a,b) a +#define crypt(a,b) (a) /* - * assumes that errno is used for sockets only - * + * Most of libpq uses "errno" to access error conditions from socket calls, + * so on Windows we want to redirect those usages to WSAGetLastError(). + * Rather than #ifdef'ing every single place that has "errno", hack it up + * with a macro instead. But there are a few places that do need to touch + * the regular errno variable. For them, we #undef and then redefine errno. */ -#undef errno -#undef EINTR -#undef EAGAIN /* doesn't apply on sockets */ - #define errno WSAGetLastError() + +#undef EAGAIN /* doesn't apply on sockets */ +#undef EINTR #define EINTR WSAEINTR #define EWOULDBLOCK WSAEWOULDBLOCK #define ECONNRESET WSAECONNRESET |