Fix another error-reporting bug, in which sk_newlistener would fail to
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 14 Nov 2012 18:32:09 +0000 (18:32 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 14 Nov 2012 18:32:09 +0000 (18:32 +0000)
capture the error code if listen() returned an error, and instead pass
0 (saved from the previous successful bind) to winsock_error_string.

git-svn-id: svn://svn.tartarus.org/sgt/putty@9708 cda61777-01e9-0310-a592-d414129be87e

windows/winnet.c

index 3a79111..c73ace9 100644 (file)
@@ -1289,7 +1289,7 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only,
 
     if (p_listen(s, SOMAXCONN) == SOCKET_ERROR) {
         p_closesocket(s);
-       ret->error = winsock_error_string(err);
+       ret->error = winsock_error_string(p_WSAGetLastError());
        return (Socket) ret;
     }