From 613fcc4c78d3bfe974754f1d3b0ebd5bbf2e5622 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 7 Sep 2008 03:22:47 +0000 Subject: Fix compilation failure on MinGW. --- src/ChangeLog | 5 +++++ src/lib/sockio-c.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index dc93a3c5..f7e95a38 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-09-06 Gabriel Dos Reis + + * lib/sockio-c.c (oa_open_ip4_client_stream_socket): Use deprecated + inet_addr on MinGW host. + 2008-09-06 Gabriel Dos Reis * interp/sys-os.boot (openIP4ClientStreamSocket): New. diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index d9bc240c..912e16a9 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -320,14 +320,16 @@ oa_open_ip4_client_stream_socket(const char* addr, openaxiom_port port) return OPENAXIOM_INVALID_SOCKET; memset(&server, 0, sizeof server); server.sin_family = AF_INET; +#ifdef __WIN32__ + if ((server.sin_addr.s_addr = inet_addr(addr)) == INADDR_NONE) { +#else if (inet_pton(AF_INET, addr, &server.sin_addr) <= 0) { - fflush(stderr); +#endif oa_close_socket(sock); return OPENAXIOM_INVALID_SOCKET; } server.sin_port = htons(port); if (connect(sock, (struct sockaddr*)&server, sizeof server) < 0) { - fflush(stderr); oa_close_socket(sock); return OPENAXIOM_INVALID_SOCKET; } -- cgit v1.2.3