diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/net.cc | 15 |
2 files changed, 8 insertions, 12 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b0c4656..6aaaa7c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2011-09-02 Corinna Vinschen <corinna@vinschen.de> + + * net.cc (cygwin_getsockopt): Drop erroneous double conversion of error + code returned by SOL_SOCKET/SO_ERROR. Fix error handling. + 2011-09-01 Corinna Vinschen <corinna@vinschen.de> * lc_msg.h: Regenerate. diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 6b63f4b..e55dd03 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -844,8 +844,9 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, optname = convert_ws1_ip_optname (optname); res = getsockopt (fh->get_socket (), level, optname, (char *) optval, (int *) optlen); - - if (level == SOL_SOCKET) + if (res == SOCKET_ERROR) + set_winsock_errno (); + else if (level == SOL_SOCKET) { switch (optname) { @@ -873,16 +874,6 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, break; } } - if (optname == SO_ERROR) - { - int *e = (int *) optval; - - debug_printf ("WinSock SO_ERROR = %d", *e); - *e = find_winsock_errno (*e); - } - - if (res) - set_winsock_errno (); } syscall_printf ("%d = getsockopt (%d, %d, 0x%x, %p, %p)", |