]> sourceware.org Git - newlib-cygwin.git/commitdiff
Minor improvements to socket error handling:
authorErik M. Bray <erik.m.bray@gmail.com>
Tue, 23 Apr 2019 14:55:33 +0000 (16:55 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 23 Apr 2019 15:21:38 +0000 (17:21 +0200)
* 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.

(cherry picked from commit 489e7e20480ff34a519d7299b226c56fa99f14a8)

winsup/cygwin/net.cc

index cd296d19d631459ec6eb2c83a272b384b912938d..437712c63531406b863c8618ee3a988b5bb41bab 100644 (file)
@@ -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
This page took 0.033853 seconds and 5 git commands to generate.