summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-12-18 22:19:36 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-12-18 22:19:36 +0000
commitef0b5ea4e04db75a7ea75edfd021e2c02d60e3f4 (patch)
tree7dfba1e847dd22de15bdf789352a439e96669092
parent487a72344828346c66759ac16c771ad881f2cdad (diff)
downloadATCD-ef0b5ea4e04db75a7ea75edfd021e2c02d60e3f4.tar.gz
more VxWorks gethostbyname () tweaks
-rw-r--r--ace/INET_Addr.cpp5
-rw-r--r--ace/OS.h1
-rw-r--r--ace/OS.i6
3 files changed, 7 insertions, 5 deletions
diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp
index 9cc37738029..09ef23182c5 100644
--- a/ace/INET_Addr.cpp
+++ b/ace/INET_Addr.cpp
@@ -187,8 +187,7 @@ ACE_INET_Addr::set (u_short port_number,
else
{
#if defined (VXWORKS)
- int address = ::hostGetByName ((char *) host_name);
- return this->set (port_number, encode ? ntohl (address) : address, encode);
+ hostent *hp = ACE_OS::gethostbyname (host_name);
#else
hostent hentry;
ACE_HOSTENT_DATA buf;
@@ -196,6 +195,7 @@ ACE_INET_Addr::set (u_short port_number,
hostent *hp = ACE_OS::gethostbyname_r (host_name, &hentry,
buf, &error);
+#endif /* VXWORKS */
if (hp == 0)
{
@@ -207,7 +207,6 @@ ACE_INET_Addr::set (u_short port_number,
(void) ACE_OS::memcpy ((void *) &addr, hp->h_addr, hp->h_length);
return this->set (port_number, encode ? ntohl (addr) : addr, encode);
}
-#endif /* VXWORKS */
}
}
diff --git a/ace/OS.h b/ace/OS.h
index d637e640fba..3e9f9c281c5 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -1379,6 +1379,7 @@ extern "C" {
int h_addrtype; /* host address type */
int h_length; /* address length */
char **h_addr_list; /* (first, only) address from name server */
+#define h_addr h_addr_list[0] /* the first address */
};
#else
#include /**/ <netdb.h>
diff --git a/ace/OS.i b/ace/OS.i
index 62db79ff63a..dc605e44d2c 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -2198,15 +2198,17 @@ ACE_OS::gethostbyname (const char *name)
#if defined (VXWORKS)
// not thread safe!
static hostent ret;
+ static int first_addr;
static char *hostaddr[2];
- if ((hostaddr[0] = (char *) ::hostGetByName ((char *) name)) < 0)
+ if ((first_addr = (char *) ::hostGetByName ((char *) name)) < 0)
return 0;
+ hostaddr[0] = (char *) &first_addr;
hostaddr[1] = 0;
ret.h_name = (char *) name; /* might not be official: just echo input arg */
ret.h_addrtype = AF_INET;
- ret.h_length = IP_ADDR_LEN;
+ ret.h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN;
ret.h_addr_list = hostaddr;
return &ret;