This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH] Minor improvements to socket error handling:
- From: "Erik M. Bray" <erik dot m dot bray at gmail dot com>
- To: cygwin-patches at cygwin dot com
- Date: Tue, 23 Apr 2019 16:55:33 +0200
- Subject: [PATCH] Minor improvements to socket error handling:
* Change default fallback for failed winsock error -> POSIX error
mappings to EACCES, which is a valid errno for more socket-related
syscalls.
* Added a few previously missing entries to the wsock_errmap table
that have obvious POSIX errno.h analogues.
---
winsup/cygwin/net.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index cd296d19d..437712c63 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -177,6 +177,9 @@ static const errmap_t wsock_errmap[] = {
{WSAEREMOTE, "WSAEREMOTE", EREMOTE},
{WSAEINVAL, "WSAEINVAL", EINVAL},
{WSAEFAULT, "WSAEFAULT", EFAULT},
+ {WSAEBADF, "WSAEBADF", EBADF},
+ {WSAEACCES, "WSAEACCES", EACCES},
+ {WSAEMFILE, "WSAEMFILE", EMFILE},
{0, "NOERROR", 0},
{0, NULL, 0}
};
@@ -188,7 +191,7 @@ find_winsock_errno (DWORD why)
if (why == wsock_errmap[i].w)
return wsock_errmap[i].e;
- return EPERM;
+ return EACCES;
}
void
--
2.15.1