diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
commit | 2a0f262beff32ba86bcb58f3273214e5d0517c09 (patch) | |
tree | 24c0ad10dab36bbd5c22743d3c88c4e0ccd5bc65 /src/port/win32gai_strerror.c | |
parent | Releasing progress-linux version 16.2-2~progress7.99u1. (diff) | |
download | postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.tar.xz postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.zip |
Merging upstream version 16.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/port/win32gai_strerror.c')
-rw-r--r-- | src/port/win32gai_strerror.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/port/win32gai_strerror.c b/src/port/win32gai_strerror.c new file mode 100644 index 0000000..5b47d17 --- /dev/null +++ b/src/port/win32gai_strerror.c @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * win32gai_strerror.c + * Thread-safe gai_strerror() for Windows. + * + * Portions Copyright (c) 2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/port/win32gai_strerror.c + * + *------------------------------------------------------------------------- + */ + +#include <sys/socket.h> + +/* + * Windows has gai_strerrorA(), but it is not thread-safe so we avoid it. + * + * https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-gai_strerrora + */ +const char * +gai_strerror(int errcode) +{ + switch (errcode) + { + case EAI_AGAIN: + return "Temporary failure in name resolution"; + case EAI_BADFLAGS: + return "Bad value for ai_flags"; + case EAI_FAIL: + return "Non-recoverable failure in name resolution"; + case EAI_FAMILY: + return "ai_family not supported"; + case EAI_MEMORY: + return "Memory allocation failure"; + case EAI_NONAME: + return "Name or service not known"; + case EAI_SERVICE: + return "Servname not supported for ai_socktype"; + case EAI_SOCKTYPE: + return "ai_socktype not supported"; + default: + return "Unknown server error"; + } +} |