11#undef UNICODE
22
3- #include < windows.h>
43#include < winsock2.h>
4+ #include < windows.h>
55#include < ws2tcpip.h>
66#include < afunix.h>
77#include < stdlib.h>
@@ -30,13 +30,13 @@ int __cdecl main(void)
3030 // Create a AF_UNIX stream server socket.
3131 ListenSocket = socket (AF_UNIX, SOCK_STREAM, 0 );
3232 if (ListenSocket == INVALID_SOCKET) {
33- printf (" socket failed with error: %ld \n " , WSAGetLastError ());
33+ printf (" socket failed with error: %d \n " , WSAGetLastError ());
3434 goto Exit;
3535 }
3636
3737 memset (&ServerSocket, 0 , sizeof (ServerSocket));
3838 ServerSocket.sun_family = AF_UNIX;
39- strncpy (ServerSocket.sun_path , SERVER_SOCKET, strlen ( SERVER_SOCKET));
39+ strncpy_s (ServerSocket.sun_path , sizeof ServerSocket. sun_path , SERVER_SOCKET, ( sizeof SERVER_SOCKET) - 1 );
4040
4141 // Bind the socket to the path.
4242 Result = bind (ListenSocket, (struct sockaddr *)&ServerSocket, sizeof (ServerSocket));
@@ -61,7 +61,7 @@ int __cdecl main(void)
6161 }
6262
6363 printf (" Accepted a connection.\n " );
64- printf (" Relayed %d bytes: '%s'\n " , strlen (SendBuffer), SendBuffer);
64+ printf (" Relayed %zu bytes: '%s'\n " , strlen (SendBuffer), SendBuffer);
6565 // Send some data.
6666 SendResult = send (ClientSocket, SendBuffer, (int )strlen (SendBuffer), 0 );
6767 if (SendResult == SOCKET_ERROR) {
0 commit comments