public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/cygwin-3_0-branch] Minor improvements to socket error handling:
Date: Tue, 23 Apr 2019 15:22:00 -0000	[thread overview]
Message-ID: <20190423152224.106389.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=debad46cfe801e319151a085beaed595cc022b4c

commit debad46cfe801e319151a085beaed595cc022b4c
Author: Erik M. Bray <erik.m.bray@gmail.com>
Date:   Tue Apr 23 16:55:33 2019 +0200

    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.
    
    (cherry picked from commit 489e7e20480ff34a519d7299b226c56fa99f14a8)

Diff:
---
 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 cd296d1..437712c 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


                 reply	other threads:[~2019-04-23 15:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190423152224.106389.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).