mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
> Ok, where's a "system dependent hack" :)
> It seems that win9x doesn't have the "netmsg.dll" so it defaults to "normal" > FormatMessage. > I wonder if one could load wsock32.dll or winsock.dll on those systems > instead of netmsg.dll. > > Mikhail, could you please test this code on your nt4 system? > Could someone else test this code on a win98/95 system? > > It works on win2k over here. It works on win2k here too but not on win98/95 or winNT. Anyway, attached is the patch which uses Magnus's my_sock_strerror function (renamed to winsock_strerror). The only difference is that I put the code to load and unload netmsg.dll in the libpqdll.c (is this OK Magnus?). Mikhail Terekhov
This commit is contained in:
@@ -23,19 +23,17 @@
|
||||
*/
|
||||
#define crypt(a,b) (a)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define errno WSAGetLastError()
|
||||
|
||||
#undef EAGAIN /* doesn't apply on sockets */
|
||||
#undef EINTR
|
||||
#define EINTR WSAEINTR
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define ECONNRESET WSAECONNRESET
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
|
||||
/*
|
||||
* Windows network messaging stuff:
|
||||
*/
|
||||
static HINSTANCE netmsgModule = NULL;
|
||||
|
||||
static char winsock_strerror_buf[512];
|
||||
const char* winsock_strerror(DWORD eno);
|
||||
|
||||
Reference in New Issue
Block a user