fix compile on windows again

This commit is contained in:
U-DESKTOP-T772REH\wangyu 2018-08-30 08:51:49 +08:00
parent 4e4a77ce16
commit a9bb76d6e8
2 changed files with 4 additions and 4 deletions

View File

@ -399,12 +399,12 @@ int inet_pton(int af, const char *src, void *dst)
{
struct sockaddr_storage ss;
int size = sizeof(ss);
char src_copy[INET6_ADDRSTRLEN+1];
char src_copy[max_addr_len+1];
ZeroMemory(&ss, sizeof(ss));
/* stupid non-const API */
strncpy (src_copy, src, INET6_ADDRSTRLEN+1);
src_copy[INET6_ADDRSTRLEN] = 0;
strncpy (src_copy, src, max_addr_len+1);
src_copy[max_addr_len] = 0;
if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
switch(af) {

View File

@ -39,7 +39,6 @@
#endif
#include <my_ev.h>
#include <netinet/in.h>
#if defined(__MINGW32__)
#include <winsock2.h>
@ -54,6 +53,7 @@ typedef int socklen_t;
#include <sys/types.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#endif