aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-10-25 08:12:14 +0000
committerdos-reis <gdr@axiomatics.org>2008-10-25 08:12:14 +0000
commitcc6e79c8eb015e0ed3df01ec9e3ba5610dfbe10f (patch)
tree79f6b1de5e2ffc54a4845f2bb482df03caee73a6 /src
parentcaa66b610f90ddc5989b72bc2b437869e74c4421 (diff)
downloadopen-axiom-cc6e79c8eb015e0ed3df01ec9e3ba5610dfbe10f.tar.gz
Fix build on Win32
Diffstat (limited to 'src')
-rw-r--r--src/lib/sockio-c.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c
index 75f94390..077f45fb 100644
--- a/src/lib/sockio-c.c
+++ b/src/lib/sockio-c.c
@@ -120,6 +120,7 @@ openaxiom_unload_socket_module(void)
static void
openaxiom_load_socket_module(void)
{
+ if (!openaxiom_socket_module_loaded) {
#ifdef __WIN32__
WSADATA wsaData;
@@ -136,6 +137,7 @@ openaxiom_load_socket_module(void)
exit(WSAGetLastError());
}
#endif
+ }
openaxiom_socket_module_loaded = 1;
}
@@ -146,6 +148,7 @@ openaxiom_load_socket_module(void)
OPENAXIOM_EXPORT int
oa_inet_pton(const char* addr, int prot, openaxiom_byte* bytes)
{
+ openaxiom_load_socket_module();
switch (prot) {
case 4: {
#ifdef __WIN32__
@@ -173,7 +176,9 @@ oa_inet_pton(const char* addr, int prot, openaxiom_byte* bytes)
OPENAXIOM_EXPORT int
oa_get_host_address(const char* n, int prot, openaxiom_byte* bytes)
{
- struct hostent* h = gethostbyname(n);
+ struct hostent* h;
+ openaxiom_load_socket_module();
+ h = gethostbyname(n);
if (h == 0)
return -1;
@@ -190,8 +195,7 @@ oa_get_host_address(const char* n, int prot, openaxiom_byte* bytes)
static inline openaxiom_socket
openaxiom_socket_stream_link(int family)
{
- if (!openaxiom_socket_module_loaded)
- openaxiom_load_socket_module();
+ openaxiom_load_socket_module();
return socket(family, SOCK_STREAM, 0);
}