File tree 1 file changed +9
-1
lines changed
contrib/win32/win32compat 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -104,12 +104,20 @@ int
104
104
socketio_acceptEx (struct w32_io * pio )
105
105
{
106
106
struct acceptEx_context * context ;
107
+ struct sockaddr_storage addr ; int addrlen = sizeof addr ;
108
+
107
109
debug5 ("acceptEx - io:%p" , pio );
108
110
context = (struct acceptEx_context * )pio -> internal .context ;
109
111
ResetEvent (pio -> read_overlapped .hEvent );
110
112
113
+ if (getsockname (pio -> sock , & addr , & addrlen ) == SOCKET_ERROR ) {
114
+ errno = errno_from_WSALastError ();
115
+ debug ("acceptEx - getsockname() ERROR:%d, io:%p" , errno , pio );
116
+ return -1 ;
117
+ }
118
+
111
119
/* create accepting socket */
112
- context -> accept_socket = socket (AF_UNSPEC , SOCK_STREAM , IPPROTO_TCP );
120
+ context -> accept_socket = socket (addr . ss_family , SOCK_STREAM , IPPROTO_TCP );
113
121
if (context -> accept_socket == INVALID_SOCKET ) {
114
122
errno = errno_from_WSALastError ();
115
123
debug3 ("acceptEx - socket() ERROR:%d, io:%p" , errno , pio );
You can’t perform that action at this time.
0 commit comments