X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/24178e4a14a3d10e5f389ce7d8eb35f6636df001..86a9c8e02f2a24d6b81009d5a6dd9ef1b6c3ed7e:/src/common/sckaddr.cpp diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 4c73c3c1e6..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 @@ -59,6 +61,7 @@ extern "C" { struct hostent *gethostbyname(const char *name); + int gethostname(char *name, int namelen); }; #endif @@ -195,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() @@ -413,3 +420,6 @@ void wxUNIXaddress::Disassemble(struct sockaddr *addr, size_t len) *m_addr = *(struct sockaddr_un *)addr; } #endif + +#endif + // wxUSE_SOCKETS