diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-11-26 04:35:09 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-11-26 04:35:09 +0000 |
commit | fff7f78f20b3b08466e75c5359aa7131e18f2c3a (patch) | |
tree | 919d92122a13a8b98d76a8fdafd48cc8d81a0008 /ace/INET_Addr.cpp | |
parent | 0a9a584abd66fa1999afb44cd77ed6d3f5fe5a1d (diff) | |
download | ATCD-fff7f78f20b3b08466e75c5359aa7131e18f2c3a.tar.gz |
ChangeLogTag:Wed Nov 25 22:28:44 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'ace/INET_Addr.cpp')
-rw-r--r-- | ace/INET_Addr.cpp | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 9691ed0d884..02e13f49d24 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -411,7 +411,7 @@ ACE_INET_Addr::get_host_name (ASYS_TCHAR hostname[], size_t len) const hostent *hp = ACE_OS::gethostbyaddr ((char *) &this->inet_addr_.sin_addr, a_len, this->addr_type_); - if (!hp) + if (hp == 0) error = errno; // So that the errno gets propagated back; it is // loaded from error below. #else @@ -430,35 +430,19 @@ ACE_INET_Addr::get_host_name (ASYS_TCHAR hostname[], size_t len) const errno = error; return -1; } - else + + if (hp->h_name == 0) + return -1; + + if (ACE_OS::strlen (hp->h_name) >= len) { - char **p; - - for (p = hp->h_addr_list; *p != 0; ++p) - if (ACE_OS::memcmp (&inet_addr_.sin_addr, - *p, - hp->h_length) == 0) - break; - - if (*p == 0) - return -1; - - char *h = hp->h_aliases[p - hp->h_addr_list]; - - if (h == 0) - h = hp->h_name; - if (ACE_OS::strlen (h) >= len) - { - errno = ENOSPC; - return -1; - } - else - { - ACE_OS::strcpy (hostname, - ASYS_WIDE_STRING (h)); - return 0; - } + errno = ENOSPC; + return -1; } + + ACE_OS::strcpy (hostname, + ASYS_WIDE_STRING (hp->h_name)); + return 0; #endif /* VXWORKS */ } } |