From eea21ee9383f652b446d60208620590860621556 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 17 Jul 2009 01:37:42 +0000 Subject: 2009-07-17 Marcus Brinkmann * src/mkerrcodes1.awk: Output code to cause WSA Errors to be transparently translated. * src/code-from-errno.c [HAVE_W32_SYSTEM]: Don't include winsock2.h. (w32_special_errnos) [HAVE_W32_SYSTEM]: Removed. (gpg_err_code_from_errno) [HAVE_W32_SYSTEM]: Remove special case. * README: Document problem with printing some WSA Errors. --- src/code-from-errno.c | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) (limited to 'src/code-from-errno.c') diff --git a/src/code-from-errno.c b/src/code-from-errno.c index 2895d82..96fcf20 100644 --- a/src/code-from-errno.c +++ b/src/code-from-errno.c @@ -23,37 +23,11 @@ #endif #include -#ifdef HAVE_W32_SYSTEM -#include -#endif #include #include "code-from-errno.h" -#ifdef HAVE_W32_SYSTEM -/* Under Windows socket related error codes are defined in a different - file and prefixed with "WSA". As their ranges don't overlap, we map - some of them to our usual error codes. */ -gpg_err_code_t -w32_special_errnos (int err) -{ - switch (err) - { - case WSAEADDRINUSE: return GPG_ERR_EADDRINUSE; - case WSAEADDRNOTAVAIL: return GPG_ERR_EADDRNOTAVAIL; - case WSAECONNABORTED: return GPG_ERR_ECONNABORTED; - case WSAECONNREFUSED: return GPG_ERR_ECONNREFUSED; - case WSAECONNRESET: return GPG_ERR_ECONNRESET; - case WSAENAMETOOLONG: return GPG_ERR_ENAMETOOLONG; - case WSAEHOSTDOWN: return GPG_ERR_EHOSTDOWN; - case WSAEHOSTUNREACH: return GPG_ERR_EHOSTUNREACH; - default: - return GPG_ERR_UNKNOWN_ERRNO; - } -} -#endif /*HAVE_W32_SYSTEM*/ - /* Retrieve the error code for the system error ERR. This returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report this). */ @@ -68,13 +42,7 @@ gpg_err_code_from_errno (int err) idx = errno_to_idx (err); if (idx < 0) - { -#ifdef HAVE_W32_SYSTEM - return w32_special_errnos (err); -#else - return GPG_ERR_UNKNOWN_ERRNO; -#endif - } + return GPG_ERR_UNKNOWN_ERRNO; return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx]; } @@ -95,13 +63,7 @@ gpg_err_code_from_syserror (void) idx = errno_to_idx (err); if (idx < 0) - { -#ifdef HAVE_W32_SYSTEM - return w32_special_errnos (err); -#else - return GPG_ERR_UNKNOWN_ERRNO; -#endif - } + return GPG_ERR_UNKNOWN_ERRNO; return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx]; } -- cgit v1.2.3