mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-04 20:59:05 -04:00
fixed compilation for windows (to be tested)
This commit is contained in:
parent
e776effc0d
commit
4a4625e2bf
1 changed files with 5 additions and 1 deletions
|
@ -75,6 +75,9 @@ void sockaddr_clear(struct sockaddr_in *addr)
|
||||||
|
|
||||||
bool rsGetHostByName(const std::string& hostname, in_addr& returned_addr)
|
bool rsGetHostByName(const std::string& hostname, in_addr& returned_addr)
|
||||||
{
|
{
|
||||||
|
#ifdef WINDOWS_SYS
|
||||||
|
hostent *result = gethostbyname(hostname.c_str()) ;
|
||||||
|
#else
|
||||||
RsTemporaryMemory mem(8192) ;
|
RsTemporaryMemory mem(8192) ;
|
||||||
|
|
||||||
if(!mem)
|
if(!mem)
|
||||||
|
@ -92,9 +95,10 @@ bool rsGetHostByName(const std::string& hostname, in_addr& returned_addr)
|
||||||
std::cerr << __PRETTY_FUNCTION__ << ": cannot call gethostname_r. Internal error reported. Check buffer size." << std::endl;
|
std::cerr << __PRETTY_FUNCTION__ << ": cannot call gethostname_r. Internal error reported. Check buffer size." << std::endl;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if(!result)
|
if(!result)
|
||||||
{
|
{
|
||||||
std::cerr << __PRETTY_FUNCTION__ << ": gethostname_r returned null result." << std::endl;
|
std::cerr << __PRETTY_FUNCTION__ << ": gethostname returned null result." << std::endl;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
// Use contents of result.
|
// Use contents of result.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue