Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2018-02-20 19:59:45 +0300
committerCorinna Vinschen <corinna@vinschen.de>2018-02-20 19:59:53 +0300
commit044ab77dcc59ec7eea0e3880d47c22f5f62cc502 (patch)
tree6f9577f0e8fd42f81e06b8039a1e1dcd4e4a396b /winsup/cygwin/net.cc
parent0a3f4e6087e0e44fd36ca2d88f619fae2dfaa02c (diff)
Cygwin: clean error mapping
- Move definition of windows to POSIX error mapping struct into cygerrno.h - Move declaration of winsock errno functions to cygerrno.h - Input to error mapping functions is DWORD Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r--winsup/cygwin/net.cc21
1 files changed, 7 insertions, 14 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index d0e4d3b57..7d73790a6 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -150,14 +150,7 @@ inet_makeaddr (int net, int lna)
return in;
}
-struct tl
-{
- int w;
- const char *s;
- int e;
-};
-
-static const struct tl errmap[] = {
+static const errmap_t wsock_errmap[] = {
{WSA_INVALID_HANDLE, "WSA_INVALID_HANDLE", EBADF},
{WSA_NOT_ENOUGH_MEMORY, "WSA_NOT_ENOUGH_MEMORY", ENOMEM},
{WSA_INVALID_PARAMETER, "WSA_INVALID_PARAMETER", EINVAL},
@@ -206,11 +199,11 @@ static const struct tl errmap[] = {
};
static int
-find_winsock_errno (int why)
+find_winsock_errno (DWORD why)
{
- for (int i = 0; errmap[i].s != NULL; ++i)
- if (why == errmap[i].w)
- return errmap[i].e;
+ for (int i = 0; wsock_errmap[i].s != NULL; ++i)
+ if (why == wsock_errmap[i].w)
+ return wsock_errmap[i].e;
return EPERM;
}
@@ -229,7 +222,7 @@ __set_winsock_errno (const char *fn, int ln)
* Since the member `s' isn't used for debug output we can use it
* for the error text returned by herror and hstrerror.
*/
-static const struct tl host_errmap[] = {
+static const errmap_t host_errmap[] = {
{WSAHOST_NOT_FOUND, "Unknown host", HOST_NOT_FOUND},
{WSATRY_AGAIN, "Host name lookup failure", TRY_AGAIN},
{WSANO_RECOVERY, "Unknown server error", NO_RECOVERY},
@@ -242,7 +235,7 @@ set_host_errno ()
{
int i;
- int why = WSAGetLastError ();
+ DWORD why = WSAGetLastError ();
for (i = 0; host_errmap[i].w != 0; ++i)
if (why == host_errmap[i].w)