X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce3ed50dbe32d118321082db84c3a9abb047d5b7..fc9ef629ac8733c4f0b844356782cca80ae09c4b:/src/common/sckaddr.cpp?ds=sidebyside diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 9fa736fdd5..234a87005b 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -20,6 +20,8 @@ #pragma hdrstop #endif +#if wxUSE_SOCKETS + #ifndef WX_PRECOMP #endif @@ -43,14 +45,10 @@ #endif // __WINDOWS__ #if defined(__UNIX__) - #ifdef VMS #include #include #else -#if defined(__FreeBSD__) || defined (__NetBSD__) -#include -#endif #include #include #include @@ -59,6 +57,14 @@ #include #include +#ifdef __SUN__ +extern "C" +{ + struct hostent *gethostbyname(const char *name); + int gethostname(char *name, int namelen); +}; +#endif + #endif // __UNIX__ #include "wx/sckaddr.h" @@ -192,7 +198,11 @@ wxString wxIPV4address::Hostname() h_ent = gethostbyaddr((char *)&(m_addr->sin_addr), sizeof(m_addr->sin_addr), GetFamily()); - return wxString(h_ent->h_name); + + if (!h_ent) + return wxString(""); + else + return wxString(h_ent->h_name); } unsigned short wxIPV4address::Service() @@ -410,3 +420,6 @@ void wxUNIXaddress::Disassemble(struct sockaddr *addr, size_t len) *m_addr = *(struct sockaddr_un *)addr; } #endif + +#endif + // wxUSE_SOCKETS