* net.cc (cygwin_getsockopt): Drop erroneous double conversion of error

code returned by SOL_SOCKET/SO_ERROR.  Fix error handling.
This commit is contained in:
Corinna Vinschen 2011-09-02 09:52:08 +00:00
parent d94522a76a
commit 35e8bb2b7e
2 changed files with 8 additions and 12 deletions

View File

@ -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.

View File

@ -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)",