X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/69919241d35e5382ca7800dd47562ff92d2918cf..cfad3750c3ecc821ffae8b9b3de852551270846d:/src/common/sckaddr.cpp?ds=inline diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 801921e8aa..e83aa78b2f 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -43,14 +43,10 @@ #endif // __WINDOWS__ #if defined(__UNIX__) - #ifdef VMS #include #include #else -#if defined(__FreeBSD__) || defined (__NetBSD__) -#include -#endif #include #include #include @@ -60,8 +56,9 @@ #include #ifdef __SUN__ -extern "C" { - int gethostname(char *name, int namelen); +extern "C" +{ + struct hostent *gethostbyname(const char *name); }; #endif @@ -83,8 +80,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) #endif wxIPV4address::wxIPV4address() - m_addr = new sockaddr_in; { + m_addr = new sockaddr_in; Clear(); } @@ -198,7 +195,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()