[AGENT++] Use of non thread safe getservbyname in AgentXSlave::bind_tcp() & AgentXMaster::bind_tcp() (agentx.cpp)

Jochen Katz katz at agentpp.com
Wed Jun 3 21:53:00 CEST 2009


Hi,

>> As per the subject title, surely this should not be used since it's
>> not thread safe?

yes.

>> Also, after looking on the web some say that the getaddrinfo function
>> should be used instead?

Again, yes. Until this has been changed you could change your local copy
to always use the default port 705 defined by AGENTX_SVC_PORT:
        if (axTCPPort == 0) {
-                if ((svc = getservbyname("agentx", "tcp")) != NULL)
-                        axTCPPort = svc->s_port;
-                else
                        axTCPPort = htons(AGENTX_SVC_PORT);
        }

Regards,
  Jochen



More information about the AGENTPP mailing list