anetTcpGenericConnect() bug introduced in 9d19977 fixed.
Durign a refactoring I mispelled _port for port. This is one of the reasons I never used _varname myself.
This commit is contained in:
parent
cf71d130a1
commit
9a1cfab59b
@ -220,15 +220,15 @@ static int anetCreateSocket(char *err, int domain) {
|
|||||||
static int anetTcpGenericConnect(char *err, char *addr, int port, int flags)
|
static int anetTcpGenericConnect(char *err, char *addr, int port, int flags)
|
||||||
{
|
{
|
||||||
int s = ANET_ERR, rv;
|
int s = ANET_ERR, rv;
|
||||||
char _port[6]; /* strlen("65535") + 1; */
|
char portstr[6]; /* strlen("65535") + 1; */
|
||||||
struct addrinfo hints, *servinfo, *p;
|
struct addrinfo hints, *servinfo, *p;
|
||||||
|
|
||||||
snprintf(_port,sizeof(port),"%d",port);
|
snprintf(portstr,sizeof(portstr),"%d",port);
|
||||||
memset(&hints,0,sizeof(hints));
|
memset(&hints,0,sizeof(hints));
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
|
|
||||||
if ((rv = getaddrinfo(addr,_port,&hints,&servinfo)) != 0) {
|
if ((rv = getaddrinfo(addr,portstr,&hints,&servinfo)) != 0) {
|
||||||
anetSetError(err, "%s", gai_strerror(rv));
|
anetSetError(err, "%s", gai_strerror(rv));
|
||||||
return ANET_ERR;
|
return ANET_ERR;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user