← Back to team overview

linuxdcpp-team team mailing list archive

[Bug 590359] Re: Socket::resolve isn't thread safe

 

makes sense since gethostbyname is deprecated.
however, i seem to recall that getaddrinfo isn't always available on every system? that being the reason that gethostbyname is still being so widely used. not that it matters to Windows as the function is present here.

could you get rid of some of the C-isms? no need to re-declare
"struct"s, and the memset can be changed to just "addrinfo hints = { 0
}".

-- 
Socket::resolve isn't thread safe
https://bugs.launchpad.net/bugs/590359
You received this bug notification because you are a member of LinuxDC++
Team, which is subscribed to LinuxDC++.

Status in DC++: Fix Committed
Status in Linux DC++: Confirmed

Bug description:
gethostbyname() shouldn't be called from multiple threads in Linux. As it may return pointer to static data that will be overwritten by the next call. (And based on the few stacktraces I've seen lately it is overwritten.) Windows seems to allocate the data for gethostbyname from thread local storage, so that will probably explain why it took so long to be reported.





References