2929*/
3030
3131#include <winsock2.h>
32+ #ifdef HAVE_AFUNIX_H
3233#include <afunix.h>
34+ #endif
3335#include <ws2tcpip.h>
3436#include <mswsock.h>
3537#include <errno.h>
@@ -119,7 +121,12 @@ socketio_acceptEx(struct w32_io* pio)
119121 }
120122
121123 /* create accepting socket */
124+ #ifdef HAVE_AFUNIX_H
122125 context -> accept_socket = socket (addr .ss_family , SOCK_STREAM , IPPROTO_IP );
126+ #else
127+ context -> accept_socket = socket (addr .ss_family , SOCK_STREAM , IPPROTO_TCP );
128+ #endif
129+
123130 if (context -> accept_socket == INVALID_SOCKET ) {
124131 errno = errno_from_WSALastError ();
125132 debug3 ("acceptEx - socket() ERROR:%d, io:%p" , WSAGetLastError (), pio );
@@ -757,7 +764,10 @@ socketio_accept(struct w32_io* pio, struct sockaddr* addr, int* addrlen)
757764int
758765socketio_connectex (struct w32_io * pio , const struct sockaddr * name , int namelen )
759766{
767+ #ifdef HAVE_AFUNIX_H
760768 struct sockaddr_un tmp_unix ;
769+ #endif
770+
761771 struct sockaddr_in tmp_addr4 ;
762772 struct sockaddr_in6 tmp_addr6 ;
763773 SOCKADDR * tmp_addr ;
@@ -779,11 +789,13 @@ socketio_connectex(struct w32_io* pio, const struct sockaddr* name, int namelen)
779789 tmp_addr4 .sin_port = 0 ;
780790 tmp_addr = (SOCKADDR * )& tmp_addr4 ;
781791 tmp_addr_len = sizeof (tmp_addr4 );
792+ #ifdef HAVE_AFUNIX_H
782793 } else if (name -> sa_family == AF_UNIX ) {
783794 ZeroMemory (& tmp_unix , sizeof (tmp_unix ));
784795 tmp_unix .sun_family = AF_UNIX ;
785796 tmp_addr = (SOCKADDR * )& tmp_unix ;
786797 tmp_addr_len = sizeof (tmp_unix );
798+ #endif
787799 } else {
788800 errno = ENOTSUP ;
789801 debug3 ("connectex - ERROR: unsuppored address family:%d, io:%p" , name -> sa_family , pio );
0 commit comments