1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

Fix residual breakage from Windows socket-errno patch: the routines

that should use regular errno, not WSAGetLastError(), now do so again.
This commit is contained in:
Tom Lane
2001-08-03 22:11:39 +00:00
parent 886d7dec79
commit 2b769c8212
4 changed files with 32 additions and 38 deletions

View File

@@ -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