diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c index af151e8470..70592afe54 100644 --- a/src/backend/port/win32/socket.c +++ b/src/backend/port/win32/socket.c @@ -47,8 +47,8 @@ int pgwin32_noblock = 0; * * Note: where there is a direct correspondence between a WSAxxx error code * and a Berkeley error symbol, this mapping is actually a no-op, because - * in win32.h we redefine the network-related Berkeley error symbols to have - * the values of their WSAxxx counterparts. The point of the switch is + * in win32_port.h we redefine the network-related Berkeley error symbols to + * have the values of their WSAxxx counterparts. The point of the switch is * mostly to translate near-miss error codes into something that's sensible * in the Berkeley universe. */ @@ -141,10 +141,15 @@ TranslateSocketError(void) case WSAEDISCON: errno = ENOTCONN; break; + case WSAETIMEDOUT: + errno = ETIMEDOUT; + break; default: ereport(NOTICE, - (errmsg_internal("unrecognized win32 socket error code: %d", WSAGetLastError()))); + (errmsg_internal("unrecognized win32 socket error code: %d", + WSAGetLastError()))); errno = EINVAL; + break; } } diff --git a/src/include/port.h b/src/include/port.h index 82f63de325..2ff529fa59 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -119,7 +119,8 @@ extern void pgfnames_cleanup(char **filenames); case EHOSTUNREACH: \ case ENETDOWN: \ case ENETRESET: \ - case ENETUNREACH + case ENETUNREACH: \ + case ETIMEDOUT /* Portable locale initialization (in exec.c) */ extern void set_pglocale_pgservice(const char *argv0, const char *app); diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h index 05c5a53442..093a009aee 100644 --- a/src/include/port/win32_port.h +++ b/src/include/port/win32_port.h @@ -381,6 +381,8 @@ extern int _pgstat64(const char *name, struct stat *buf); #define ENETUNREACH WSAENETUNREACH #undef ENOTCONN #define ENOTCONN WSAENOTCONN +#undef ETIMEDOUT +#define ETIMEDOUT WSAETIMEDOUT /* * Locale stuff. diff --git a/src/port/strerror.c b/src/port/strerror.c index c07c983e75..9b98f77b42 100644 --- a/src/port/strerror.c +++ b/src/port/strerror.c @@ -250,10 +250,8 @@ get_errno_symbol(int errnum) #endif case ESRCH: return "ESRCH"; -#ifdef ETIMEDOUT case ETIMEDOUT: return "ETIMEDOUT"; -#endif #ifdef ETXTBSY case ETXTBSY: return "ETXTBSY";